[英]Location of UITableViewController files
I have multiple tableviews that have various static cells and everything is cool. 我有多个具有各种静态单元格的表视图,并且一切都很酷。
I would like to implement some functionality to a button that is in one of the cells in all of the tables, but I do not know where the header and implementation files for UITableViewController
are located and or how to access them. 我想为所有表的单元格之一中的按钮实现一些功能,但是我不知道UITableViewController
的头文件和实现文件位于何处以及如何访问它们。 Any ideas? 有任何想法吗?
You can't directly manipulate UITableViewController
. 您不能直接操纵UITableViewController
。 Besides, it is not a good idea to do it anyway. 此外,无论如何也不是一个好主意。 The best way to do it is subclassing it. 最好的方法是将其子类化。
NSObject
file Command + N并创建一个新的NSObject
文件 MyTableViewController
) 出现提示时, MyTableViewController
命名(例如MyTableViewController
) MyTableViewController.h
in left side pane, and change NSObject
to UITableViewController
. 单击左侧窗格中的MyTableViewController.h
,然后将NSObject
更改为UITableViewController
。 UITableViewController
to MyTableViewController
. 转到XIB文件或情节提要(无论使用哪种方式),然后将UITableViewController
的类更改为MyTableViewController
。 tag
field (eg 1001). 在按钮的tag
字段中输入一个数字(例如1001)。 cellAtIndexPath:
) and then get a hold of that button with tag ( [cell.contentView viewWithTag:]
). 现在,在MyTableViewController.m类中,获得单元格( cellAtIndexPath:
,然后获得具有标签( [cell.contentView viewWithTag:]
)的按钮的[cell.contentView viewWithTag:]
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.