iphone - 实现自定义 UITableViewCellAccessoryType 以用作复选标记(如待办事项列表)的最佳方法

标签 iphone uitableview

我需要使用 UITableView 创建一个 list ,并将accessoryView作为自定义复选框并勾选,最好(快速且高效)的方法是什么?

此外,从accessoryButtonTappedForRowWithIndexPath中勾选/取消勾选它并存储/检索行的当前状态(选中/未选中)的最佳方法是什么:

-(void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath {
   if (something==isChecked) {
       change accessoryView to unchecked
       // do stuff
   } else {
       change accessoryView to unchecked
       // do stuff
   }
}

谢谢!

最佳答案

我刚刚发现苹果公司已经创建了一个这样的例子!对于任何寻找相同内容的人来说,这是一个链接:

http://developer.apple.com/iphone/library/samplecode/Accessory/Introduction/Intro.html

关于iphone - 实现自定义 UITableViewCellAccessoryType 以用作复选标记(如待办事项列表)的最佳方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3399121/

相关文章:

iphone - 整数常量

ios - 在 Xcode 5 中工作后,Xcode 中的 GPS 跟踪在 Xcode 6 中停止工作

swift - 当我向下滚动并返回时,我的数据在 UITableViewCell 中发生变化

iphone - UITabBarViewController 崩溃

ios - UITableview 部分?

ios - iPad 中的 .ipa 文件为空白但在 iPhone 中有效

iphone - 如何在 Objective-C 中正确访问基类属性?

iphone - Facebook 整合问题

ios - 为表格 View 的高度分配上限?

ios - 如何使用 Storyboard UI 在 Main WIndow 之外添加 UIViews?