iOS中属性和字段之间的差异

时间:2011-08-08 13:47:43

标签: ios objective-c properties

有人可以解释一下我们之间究竟有什么区别:

@interface PersistenceViewController : UIViewController { 
    UITextField *field1; 
    UITextField *field2; 
    UITextField *field3;
} 

@property (nonatomic, retain) IBOutlet UITextField *field1; 
@property (nonatomic, retain) IBOutlet UITextField *field2; 
@property (nonatomic, retain) IBOutlet UITextField *field3; 

@interface PersistenceViewController : UIViewController { 
} 
@property (nonatomic, retain) IBOutlet UITextField *field1; 
@property (nonatomic, retain) IBOutlet UITextField *field2; 
@property (nonatomic, retain) IBOutlet UITextField *field3; 

他们似乎都以同样的方式工作。

0 个答案:

没有答案