Swift-Add disclosure indicator to a UITableViewCell
In Swift 4 and Swift 5 this would be:
cell.accessoryType = .disclosureIndicator
You can also set it in IB if appropriate: Attributes Inspector > Table View Cell > Accessory.
That arrow isn't a UINavigationItem
; it's a UITableViewCellAccessoryDisclosureIndicator
.
To add that UITableViewCell.AccessoryType.disclosureIndicator
"arrow" to your cell's accessory view, add this line:
cell.accessoryType = UITableViewCellAccessoryType.DisclosureIndicator
And then to perform a specific action when that accessory view is tapped, implement tableView:accessoryButtonTappedForRowWithIndexPath:
.
First things first. If you need navigation between view controllers, you need to embed the first view controller in a navigation controller. Each navigation controller maintains a stack on which you can push view controllers. Please refer to the navigation controller documentation. If you want the '>' show up by default, goto the storyboard, click on the cell, goto the fourth tab on the right hand side, select the accessory as 'Disclosure Indicator'.