Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fire a method from a Static Cell in a Table view Controller

In my code i have a table with static cell inside storyboards. I'm trying to fire a method upon clicking the last static cell.

What should i write in the code to make this happen. How can i refer static cells inside the code without firing error.

like image 691
carbonr Avatar asked Sep 11 '25 13:09

carbonr


1 Answers

In the viewController add:

@property (nonatomic, weak) IBOutlet UITableViewCell *theStaticCell;  

Connect that outlet to the cell in the storyboard.

Now in tableView:didSelectRowAtIndexPath method:

UITableViewCell *theCellClicked = [self.tableView cellForRowAtIndexPath:indexPath];
if (theCellClicked == theStaticCell) {
    //Do stuff
}
like image 92
Gobot Avatar answered Sep 14 '25 03:09

Gobot