简体   繁体   English

自定义UITableView单元格

[英]Custom UITableView Cell

What is the Right Way to Implement This? 什么是实现此目标的正确方法?

For example, say I created an XIB file with a button in it. 例如,假设我创建了一个带有按钮的XIB文件。 Say a button on that custom controller get pressed, how do the program knows which "row" of the UITableView get pressed? 假设该自定义控制器上的按钮被按下,程序如何知道UITableView的哪个“行”被按下? Does each row has their own UITableViewCell Controller? 每行是否都有自己的UITableViewCell控制器?

There has to be one right way to design this. 必须设计一种正确的方法。

You can follow the tutorial for custom cells - 您可以按照教程中的自定义单元格进行操作-

http://cocoawithlove.com/2009/04/easy-custom-uitableview-drawing.html http://cocoawithlove.com/2009/04/easy-custom-uitableview-drawing.html

You are asking about two different controls (buttons and cells), but anyway both have a similar way to "communicate" with the controller. 您要问的是两个不同的控件(按钮和单元格),但是无论如何,两者都具有与控制器“通信”的相似方式。 With the button's tag and the cell's index , you have enough to be able to manage the use of these controls. 使用按钮的标记和单元格的索引 ,您有足够的能力来管理这些控件的使用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM