【发布时间】:2012-02-27 21:41:54
【问题描述】:
如果用户检查 UITableViewCell 中的某些内容,我会使用此方法检查 NSMutableDictionary *checkDict:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if ([[checkDict objectForKey:[array objectAtIndex:indexPath.row]] isEqualToString:@"Check"]) {
[checkDict setObject:@"NOCheck" forKey:[array objectAtIndex:indexPath.row]];
[table reloadData];
}
else
{
[checkDict setObject:@"Check" forKey:[array objectAtIndex:indexPath.row]];
[table reloadData];
}
}
在这个类中我设置了属性:
@property (nonatomic, strong) NSMutableDictionary *checkDict;
我想用“Check”作为在 checkDict MutableDictionary 中设置的对象的信息填充下一个视图。如何从下一堂课访问这个 MutableDict?如果我实例化包含上述代码的前一个类,我会为 checkDict 得到 null。我正在使用 ARC 和 StoryBoard。除了:
[[NSUserDefaults standardUserDefaults]setObject:checkDict forKey:@"CheckDict"];
【问题讨论】:
标签: iphone uitableview automatic-ref-counting nsmutabledictionary