iOS 8新特性之扩展

iOS8之Extension

区别类的扩展

@interface MyClass : NSObject

- (float)value;

@end

@interface MyClass () { //注意此处:扩展

float value;

}

- (void)setValue:(float)newValue;

@end

@implementation MyClass

- (float)value {

return value;

}

- (void)setValue:(float)newValue {

value = newValue;

}

@end

你可能感兴趣的:(iOS 8新特性之扩展)