如在m文件中:
@interface KCLoginViewController (){
UITextField *_txtUserName;
UITextField *_txtPassword;
}
与在h文件中:
@property UITextField *_txtUserName;
@property UITextField *_txtPassword;
这两种方式有何差异呢?
阿神2017-04-24 09:13:44
The standard syntax is @property UITextField *txtUserName; without underlining, this method will automatically generate a getter setter method, so it can be accessed with self.txtUserName, and a member variable of _txtUserName will be created,
And @interface KCLoginViewController (){
UITextField *_txtUserName; UITextField *_txtPassword;
}
The getter setter method will not be generated, so you can only access it with _txtUserName _txtPassword