@implementation NSArray (JSArrayIndexedKVC) - (id)valueForUndefinedKey:(NSString )key {
int index;
if ([[NSScanner scannerWithString:key] scanInt:&index])
if (index < [self count])
return [self objectAtIndex:index];
return [super valueForUndefinedKey:key];
} @end
摘自
http://cocoadev.com/wiki/KeyValueCoding
让NSArray支持 Key Value Coding 方法 (用 @n 检索)
最新推荐文章于 2021-08-02 15:45:15 发布