2013-04-20 31 views
0

我是IOS的新手,在学习了大量在线教程后,我发现ViewController类的属性放在@interface的大括号内。一些UI属性被放置为@properties以及@interface,其中一些属于后者。头文件中的Objective-C属性 - IOS

@interface ViewController : UIViewController 
{ 
    NSMutableArray *array; 
    NSString *string; 
} 

@property (strong, nonatomic) NSMutableArray *array; 
@property (strong, nonatomic) NSString *string; 
@property (strong, nonatomic) NSDate *date; 

@end 

@interface中的属性是相同的私有财产,或者这是什么东西?

回答

0

根据我,@interface大括号内的变量是私有变量。但是当您为它们设置@property时,这些变为受保护的变量。所以当你的课程#import,那么你可以访问它们。

+0

感谢您的回答。所以,当你的意思是保护,这是否意味着一般编程中提到的保护? – user1574598 2013-04-21 19:26:28

+0

yap,那种...可以通过继承类来访问的显式变量.. – NULL 2013-04-21 19:34:49