我有这样的属性:@property (nonatomic, assign, readonly) CGRect frame;
在example.h文件中,我认为这个语句是告诉其他类frame属性是只读的,它也告诉编译器不需要综合setter方法。 是否正确地表示类本身可以在.m文件中使用实例变量_frame(self.frame仍然不能使用)?如果是这样,有没有更好的方式来使用这个实例变量_frame?重新声明这个属性的类扩展为读写或重新声明在类扩展这样的实例变量(我发现有很多人这样写,但我不知道这样做有什么好处呢?):有没有更好的方法来写OC的财产?
@interface example() {
CGRect _frame;
}
@end
@implementation example
或我只需要什么都不做?
[我应该使用属性还是实例变量?](http://www.bignerdranch.com/blog/should-i-use-a-property-or-an-instance-variable/) – twodayslate 2014-08-28 06:44:48