Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swift-Add disclosure indicator to a UITableViewCell

I'm new to iOS. I had 2 Table View Controllers and I want user to click on 1 cell to navigate to the other Controllers.

However here you can see the sign ">" next to the item, same as in Settings app in iOS 8. https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/TableView_iPhone/TableViewAndDataModel/TableViewAndDataModel.html

But I cannot add Navigation Item to a cell and no matter what segue I use the '>' doesn't show up.

Any idea?

like image 768
Motoko Avatar asked Dec 25 '14 05:12

Motoko


1 Answers

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:.

like image 103
Lyndsey Scott Avatar answered Oct 03 '22 14:10

Lyndsey Scott