从表视图控制器中的静态单元格中触发方法 [英] 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.
推荐答案
在viewController中添加:
In the viewController add:
@property (nonatomic, weak) IBOutlet UITableViewCell *theStaticCell;
将该插座连接到故事板中的单元格。
Connect that outlet to the cell in the storyboard.
现在在 tableView:didSelectRowAtIndexPath
方法:
UITableViewCell *theCellClicked = [self.tableView cellForRowAtIndexPath:indexPath];
if (theCellClicked == theStaticCell) {
//Do stuff
}
这篇关于从表视图控制器中的静态单元格中触发方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文