0
假設所有下面的代碼被寫入在實現文件.Could有人解釋的區別:高德VS類擴展
#1
@interface ViewController()
@property (nonatomic) NSDictionary *currentAlbumData;
@end
@implementation ViewController
#2
@interface ViewController() {
NSDictionary *currentAlbumData;
}
@end
@implementation ViewController
#3
@interface ViewController
@end
@implementation ViewController {
NSDictionary *currentAlbumData;
}
- some methods here -
@end
我看到它的方式,第一個在一個類中聲明瞭一個屬性變量延期。第二個聲明一個類擴展中的實例變量。第三個聲明一個不是類擴展的實例變量......這意味着什麼?它是如何比較簡單地在一個類擴展中聲明一個伊娃?
關於MYSELF的知名度?正如我可以在同一個文件中看到擴展變量,而不是導航到別處的其他文件?不是很清楚。另外,它不是範圍問題(如文件範圍vs全球範圍)? –
任何可以看到它的代碼都可以看到'@ interface'節中定義的實例變量。不管這個'@interface'是一個擴展還是主要擴展。 – Avi