將聲明中的@interface{}
聲明中的變量放入頭文件並在聲明後放入@property
之間有什麼區別?接口聲明中@property和變量之間的區別
例如,
@interface GameCenterManager : NSObject
{
GKInvite* pendingInvite;
}
@end
而非
@interface GameCenterManager : NSObject
@property (weak, nonatomic) GKInvite* pendingInvite
@end
這個問題類似的位置:http://stackoverflow.com/questions/4172810/what-is-the-difference-between-ivars-and- properties-in-objective-c –