我是iOS新手,已经从教程和我的教授那里学习。
在.h
文件有:@synthesize与自我使用
@interface ViewController : UIViewController <UITextFieldDelegate>
@property (strong, nonatomic) IBOutlet UILabel *myResponse;
@property (strong, nonatomic) IBOutlet UITextField *myInput;
@end
在.m
文件有:
@sysnthesize myResponse
@synthesize myInput
我的问题是这样的:有什么区别,在.m
文件,添加的@synthesize
和然后使用诸如[myInput <do something here>]
之类的属性与删除@synthesize
并使用[self.myInput <do something here>]
。我在Xcode 5上运行,所以我明白我有自动综合可用,但是两者之间有更细微的差别吗?
我的教授使用了@synthesize
,我接下来的教程只是使用self.propertyName
,因此我很好奇。
谢谢。
如果您刚开始学习,最好阅读Apple文档以获取大多数基本问题:https://developer.apple.com/library/ios/documentation/cocoa/conceptual/ProgrammingWithObjectiveC/EncapsulatingData/EncapsulatingData.html –
和不要再使用@synthesize –