带有索引的 iPhone UITableView 我可以为每个不同的单元格推送不同的详细视图吗?
我知道可以创建一个侧面有索引、顶部有搜索栏的表,用户可以输入该搜索栏来查找项目,但是是否可以对表说,如果数组等于“item1”push视图1?我想为每个单元格推送不同的视图。有人有什么建议吗?
I know its possible to create a table that has an index on the side and a search bar at the top that a user can type in to find an item, but is it possible to say to the table if array isEqual to "item1" push view1? I would like to push a different view with each cell. Anyone have any advice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
当然。只需根据
tableView:didSelectRowAtIndexPath:
中单元格的indexPath
创建适当的视图(控制器)即可。Sure. Just create the appropriate view (controller) depending on the cell's
indexPath
intableView:didSelectRowAtIndexPath:
.根据索引路径创建单元格。如果提前创建所有单元格,请按行索引将它们存储在数组中。如果您根据需要创建它们,请执行以下操作:
Create the cell based on the index path. If you create all the cells ahead of time, store them in an array by row index. If you are creating them as needed, do something like this:
查看《Beginning iPhone Development》一书中的示例程序。您必须注册,但它是免费的。您应该专门查看第 9 章名为 Nav 的示例代码。准确地向您展示您所需要的内容。这是我关于这个主题的第一本书,非常值得。
http://www.iphonedevbook.com/forum/viewforum.php?sid= 3010c045df967353c6b3894889e6b8f5
干杯!
肯
Check out the sample programs from the book Beginning iPhone Development. You must sign up, but its free. You should look specifically at chapter 9's sample code called Nav. Shows you exactly what you need. This was my first book on the subject and was well worth it.
http://www.iphonedevbook.com/forum/viewforum.php?sid=3010c045df967353c6b3894889e6b8f5
Cheers!
Ken