我知道它可以创建一个表,该表的侧面有一个索引,顶部有一个搜索栏,用户可以输入该搜索栏来查找项目,但是如果数组 isEqual to "item1" push,是否可以对表说视图1?我想为每个单元格推送不同的视图。有人有什么建议吗?
3 回答
2
当然。只需根据单元格的indexPath
in创建适当的视图(控制器) tableView:didSelectRowAtIndexPath:
。
于 2010-05-01T20:54:39.830 回答
0
查看《开始 iPhone 开发》一书中的示例程序。您必须注册,但它是免费的。您应该专门查看第 9 章的示例代码 Nav。准确显示您的需求。这是我关于这个主题的第一本书,非常值得。
http://www.iphonedevbook.com/forum/viewforum.php?sid=3010c045df967353c6b3894889e6b8f5
干杯! 肯
于 2010-05-01T21:11:18.307 回答
0
根据索引路径创建单元格。如果您提前创建所有单元格,请按行索引将它们存储在数组中。如果您根据需要创建它们,请执行以下操作:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *result;
switch ( [indexPath row] ) {
default: result = [self tableView:tableView normalCellForRowAtIndexPath:indexPath]; break;
case 3: result = [self tableView:tableView detail3CellForRowAtIndexPath:indexPath]; break;
case 5: result = [self tableView:tableView detail5CellForRowAtIndexPath:indexPath]; break;
}
return result;
}
于 2010-05-01T21:40:35.163 回答