简体   繁体   English

如何在没有 UITableView 的情况下实现 UITableViewCell

[英]How to implement UITableViewCell without UITableView

I want to use the power of UITableViewCell like disclosure accessory, but I don't need the whole UITableView.我想使用 UITableViewCell 之类的披露附件的功能,但我不需要整个 UITableView。 Is this possible and appropriate to do so?这样做是否可行且合适? I don't see any delegate on UITableViewCell, so don't know where should I put code previously in - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath;我在 UITableViewCell 上没有看到任何委托,所以不知道我应该将之前的代码放在哪里- (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath; any references or suggestions on this?对此有任何参考或建议吗?

You could just make a UITableView with one section and one row, and load that cell into it.您可以只制作一个UITableView一个部分和一行,然后将该单元格加载到其中。 This would be pretty easy to do and wouldn't run the risk of running afoul of the Apple review board.这很容易做到,并且不会冒与 Apple 审查委员会发生冲突的风险。

Correct me if im wrong but.. Why would you use a cell like that?如果我错了,请纠正我,但是..你为什么要使用这样的单元格? If you dont want to use the power of the UITableView you can just add a view and do all the stuff you do in your cell.如果您不想使用 UITableView 的强大功能,您可以添加一个视图并执行您在单元格中执行的所有操作。 And that would keep the Apple Standard too.这也将保留 Apple 标准。

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

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