改变accessoy图像工作,但我想改变列表中的BOOL值



我使用了下面的例子来改变UITableViewCell的(附件)图像。效果很好。但是,代码只更改图像,而不更改列表中的值。http://www.edumobile.org/iphone/iphone-programming-tutorials/impliment-a-custom-accessory-view-for-your-uitableview-in-iphone/

在下面的方法中,我想将更改后的BOOL保存在datlist .plist中。

- (void)checkButtonTapped:(id)sender event:(id)event
{
NSSet *touches = [event allTouches];
UITouch *touch = [touches anyObject];
CGPoint currentTouchPosition = [touch locationInView:self.tableView];
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint: currentTouchPosition];
if (indexPath != nil)
{
[self tableView: self.tableView accessoryButtonTappedForRowWithIndexPath: indexPath];
}

最好的方法是什么?

只需更新用于填充表视图的(可变)数据数组。当数据发生更改并且希望持久化它时,可以通过标准文件管理器调用将整个数据数组写入磁盘。

不幸的是,plists只能一次读/写。

最新更新