我对自定义 UITableViewCell 中的复选框有疑问。当我触摸复选框时,图像更改(“checked.png”-->“unchecked.png”和“unhacked.png”-->“checked.png”)并且值保存在数据库(SQLLite)中。问题是,如果我进入一个有“检查”复选框的视图并触摸它,图像不会改变,但如果我重新加载视图,图像是正确的!如何在事件“按下复选框”时自动重新加载视图?这是我的代码:
// called when the checkmark button is touched
- (void)checkAction:(id)sender
{
// note: we don't use 'sender' because this action method can be called separate from the button (i.e. from table selection)
self.checked = !self.checked;
UIImage *checkImage = (self.checked) ? [UIImage imageNamed:@"checked.png"] : [UIImage imageNamed:@"unchecked.png"];
[checkButton setImage:checkImage forState:UIControlStateNormal];
}
非常感谢您的任何建议!
斯特凡诺