Properties 头文件中的Objective-C属性-IOS
我是IOS新手,在学习了许多在线教程之后,我遇到了一种情况,Properties 头文件中的Objective-C属性-IOS,properties,uiviewcontroller,Properties,Uiviewcontroller,我是IOS新手,在学习了许多在线教程之后,我遇到了一种情况,ViewController类的属性被放在@界面的花括号中。一些UI属性被放置为@properties以及@interface中,而一些则位于后者中 @interface ViewController : UIViewController { NSMutableArray *array; NSString *string; } @property (strong, nonatomic) NSMutableArray *
ViewController
类的属性被放在@界面的花括号中。一些UI属性被放置为@properties
以及@interface
中,而一些则位于后者中
@interface ViewController : UIViewController
{
NSMutableArray *array;
NSString *string;
}
@property (strong, nonatomic) NSMutableArray *array;
@property (strong, nonatomic) NSString *string;
@property (strong, nonatomic) NSDate *date;
@end
@interface
中的属性是否与私有属性相同,或者这是其他内容?根据我的说法,@interface
花括号中的变量是私有变量。但当您为它们设置@property
时,它们将成为受保护的变量。因此,当您导入类时,您可以访问它们 谢谢你的回答。所以当你指的是受保护的时候,这是指一般编程中提到的受保护吗?是的,有点。。。显式变量,可通过继承类进行访问。。