本文共 1705 字,大约阅读时间需要 5 分钟。
? NSDictionary ??objectForKey: ? valueForKey: ???????????????????????????????????????????????????????????????????????????????????????
objectForKey: ? valueForKey: ????? NSDictionary ??????????????????????????????????????? nil ???????????
??????????????????????????valueForKey: ??? Key-Value Coding?KVC????????? objectForKey: ?????????????????????????????????
valueForKey: ??????????????????
????key??? "@" ?????valueForKey: ????? objectForKey: ????????????????????????
???? "@" ???valueForKey: ???? "@" ??????? super ? valueForKey: ????????????????????????????valueForKey: ????????????????????????????
??????????????????????
NSDictionary *dict = [NSDictionary dictionaryWithObject:@"theValue" forKey:@"theKey"];NSString *value1 = [dict objectForKey:@"theKey"];NSString *value2 = [dict valueForKey:@"theKey"];
???????value1 ? value2 ?????????????????
NSDictionary *dict = [NSDictionary dictionaryWithObject:@"theValue" forKey:@"@theKey"];NSString *value1 = [dict objectForKey:@"@theKey"];NSString *value2 = [dict valueForKey:@"@theKey"];
???????value1 ???????????????? objectForKey: ????? value2 ???????????? "@" ???valueForKey: ??? "@" ??? super ? valueForKey: ????????? "theKey" ????????????? "theKey" ????valueForKey: ?????? valueForUndefinedKey: ??????? NSUndefinedKeyException ??????????
??????????objectForKey: ? valueForKey: ???????????????????? "@" ????valueForKey: ???????????????????????? NSDictionary ?????????? objectForKey: ?????????????????????
?????????????? Objective-C ????????????? valueForKey: ?????????????????????????????????????????????????????????????????????????
转载地址:http://lynfk.baihongyu.com/