【发布时间】:2011-04-28 06:56:53
【问题描述】:
当我在玩游戏并弄清楚https://github.com/enormego/EGOTableViewPullRefresh 的工作原理时,我发现@property 和@synthesize 很神秘。这是我提到的代码
EGORefreshTableHeaderView.h
@interface EGORefreshTableHeaderView : UIView {
id _delegate;
EGOPullRefreshState _state;
UILabel *_lastUpdatedLabel;
UILabel *_statusLabel;
CALayer *_arrowImage;
UIActivityIndicatorView *_activityView;
}
@property(nonatomic,assign) id <EGORefreshTableHeaderDelegate> delegate;
EGORefreshTableHeaderView.m
@synthesize delegate=_delegate;
我已阅读此http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocProperties.html,据我了解,它为 _delegate 创建了新名称,即代表。 (我的理解正确吗?)
但我仍然不明白他们为什么要用那些@synthesize = 指令让事情变得复杂。
【问题讨论】:
标签: objective-c properties synthesis