如果我們使用一個財產沒有「保留」,它是什麼改變?我有這個例子:財產沒有保留與例
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
- (id)initWithCoordinate:(CLLocationCoordinate2D) coordinate;
在.M:
-(id)initWithCoordinate:(CLLocationCoordinate2D)coord{
coordinate = coord;
return self;
}
的 「保留」 通常用於設置器,是嗎?所以在這裏,我們使用setter,在initWith ...中,但我們不使用「保留」...任何想法?
感謝
感謝您的傑出答案,我不確定要理解非原子事物,這意味着什麼「同步財產」?我通過文檔閱讀,但我不確定這個意思。爲了說明,非常感謝 – Paul
@Paul:基本上,這意味着讀寫操作被鎖定環繞,以防止兩者在線程環境中同時發生。 – JeremyP
好的,那麼這個非原子有什麼改變嗎? – Paul