/
KVC访问非属性变量
KVC访问非属性变量
kvcs是否可以访问非属性变量,答案是可以的.
@interface ModelDemo : NSObject { //@private NSString *demoString; } @end
ModelDemo *demo = [[ModelDemo alloc] init]; [demo setValue:@"Demo" forKey:@"demoString"]; NSLog(@"%@",[demo valueForKey:@"demoString"]);
不会出现crash.即使加上@private.同样可以访问.
, multiple selections available,
Related content
NSString+MD5
NSString+MD5
More like this
iOS生产力之小工具合集
iOS生产力之小工具合集
More like this
How Best to Use Delegates and Notifications in Objective-C
How Best to Use Delegates and Notifications in Objective-C
More like this
NSLayoutConstraint-代码实现自动布局的函数用法说明
NSLayoutConstraint-代码实现自动布局的函数用法说明
More like this
谈谈iOS Animation
谈谈iOS Animation
More like this
NSMutableAttributedString
NSMutableAttributedString
More like this