support cell type: detailDesclosure

This commit is contained in:
Bob Sun 2017-02-09 11:12:14 +08:00
parent 6411645568
commit fca0b50990
No known key found for this signature in database
GPG key ID: 1F86BA2052FED3B4
3 changed files with 21 additions and 5 deletions

View file

@ -31,11 +31,17 @@ class OpenSourceComponentsTableViewController: BasicStaticTableViewController {
tableData.append([])
for item in openSourceComponents {
tableData[0].append(
[CellDataKey.type: CellDataType.link, CellDataKey.title: item[0], CellDataKey.link: item[1]]
[CellDataKey.type: CellDataType.link, CellDataKey.title: item[0], CellDataKey.link: item[1], CellDataKey.accessoryType: UITableViewCellAccessoryType.detailDisclosureButton, CellDataKey.detailDisclosureAction: #selector(actOnDetailDisclosureButton(_:)), CellDataKey.detailDisclosureData: item[2]]
)
}
navigationItemTitle = "Open Source Components"
super.viewDidLoad()
}
func actOnDetailDisclosureButton(_ sender: Any?) {
if let link = sender as? String {
UIApplication.shared.open(URL(string: link)!, options: [:], completionHandler: nil)
}
}
}