小编Lig*_*Man的帖子

iOS7 NSKeyedArchiver警告:替换键'UITintColor'的现有值; 类层次结构中可能的重复编码键

我使用xib创建了一个uitableviewcell.我有一个细胞工厂,细胞以这种方式取消存档:

- (instancetype)initWithNib:(NSString *)aNibName
{
    self = [super init];    
    if (self != nil) {

        self.viewTemplateStore = [[NSMutableDictionary alloc] init];
        NSArray * templates = [[NSBundle mainBundle] loadNibNamed:aNibName owner:self options:nil];

        for (id template in templates) {
            if ([template isKindOfClass:[UITableViewCell class]]) {                
                UITableViewCell * cellTemplate = (UITableViewCell *)template;
                NSString * key = cellTemplate.reuseIdentifier;

                if (key) {
                    [self.viewTemplateStore setObject:[NSKeyedArchiver archivedDataWithRootObject:template] forKey:key];
                } else {
                    @throw [NSException exceptionWithName:@"Unknown cell"
                                                   reason:@"Cell has no reuseIdentifier"
                                                 userInfo:nil];
                }
            }
        }
    }
    return self;
}

- (UITableViewCell *)cellOfKind:(NSString *)theCellKind …
Run Code Online (Sandbox Code Playgroud)

uitableview ios

5
推荐指数
1
解决办法
2233
查看次数

标签 统计

ios ×1

uitableview ×1