我有一个UITableView,当我使用这个代码推送视图时(简化的'dic'存在)。它第一次加载标记对象。但是当我回去打开一个不同的单元格时,它使用相同的标记对象。我应该使用后退按钮上的选择器来取消self.ViewController
。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (!self.ViewController) {
self.ViewController = [[TextViewController alloc] initWithNibName:@"ViewController" bundle:nil markup:[dic objectForKey:@"text"]];
}
[self.navigationController pushViewController:self.ViewController animated:YES];
}
该属性不会更新。为了确保我尝试了不同的设置方法。
我可以将标记属性设置为超弱设置吗?
答案 0 :(得分:0)
解决。如果它已经存在,我只是将self.ViewController取消。我在代码的开头使用了这个。
if (self.ViewController) {
self.ViewController = nil;
}