美文网首页
iOS forUndefinedKey你知道吗?

iOS forUndefinedKey你知道吗?

作者: DL是谁 | 来源:发表于2019-08-22 17:48 被阅读0次

    不用runtime,直接kvc

    添加初始化方法

    - (instancetype)initWithDictionary:(NSDictionary*)dictionary{
        self = [super init];
        if (self) {
            [self setValuesForKeysWithDictionary:dictionary];
        }
        return self;
    }
    

    重写
    - (void)setValue:(id)value forUndefinedKey:(NSString *)key

    爽~~

    相关文章

      网友评论

          本文标题:iOS forUndefinedKey你知道吗?

          本文链接:https://www.haomeiwen.com/subject/nddosctx.html