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