我正在尝试实现一个 TableView,其中每个单元格都有一个“+
”按钮,就像将歌曲添加到播放列表时的 iPod 应用程序一样。
cell.accesoryType
只有四个值
UITableViewCellAccessoryCheckmark
UITableViewCellAccessoryDetailDisclosureButton
UITableViewCellAccessoryDisclosureIndicator
和
None
如何做到这一点?我是否需要创建自定义按钮并设置 cell.accessoryView
还是有其他方法可以做到这一点?
最佳答案
Teo 的解决方案效果很好,但它还没有作为答案发布,所以我重新发布它:
UIButton *button = [UIButton buttonWithType:UIButtonTypeContactAdd];
[button addTarget:self action:@selector(addbuttonTapped) forControlEvents:UIControlEventTouchUpInside];
cell.accessoryView = button;
关于iphone - 为 AccessoryType TableView 添加 "Plus"按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6314958/