Reputation: 95
I have custom cell class for each cell I have on my table. I added detail accessory type to each cell. I want the user to click on the detail accessory type (the blue circle with i in it) and a pop up should show more information about that specific cell. I have googled around and have not found a solution for detail accessory type.
Following is the custom class for my first cell.
class SocialTableCell: UITableViewCell {
@IBOutlet weak var social:UILabel?
@IBOutlet weak var toggle:UISwitch?
override func awakeFromNib() {
super.awakeFromNib()
}
override func setSelected(selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
}
}
Any Help will be highly appreciated. Thanks
Upvotes: 0
Views: 767
Reputation: 27620
The UITableViewDelegate
protocol has a method tableView:accessoryButtonTappedForRowWithIndexPath:
that is being called when a user tapped on the accessory button in one of the cells. So you have to implement that method in your TableViewController:
func tableView(_ tableView: UITableView, accessoryButtonTappedForRowWithIndexPath indexPath: NSIndexPath) {
// show the alert here
}
Also you have to make sure that you set the UITableView.delegate
to the ViewController that implements that method.
Upvotes: 1