@property и @synthesize в objective-c

Пока я играл и выяснял, как все работает в 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  delegate;

EGORefreshTableHeaderView.m

@synthesize delegate=_delegate;

Я прочитал http: //developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjectiveC/Chapters/ocProperties.html и, насколько я понимаю, создает новое имя для _delegate, который является делегатом. (Прав ли я в этом понимании?)

Но я до сих пор не понимаю, почему они должны усложнять ситуацию с помощью директивы @synthesize =.

18
задан Electric Coffee 22 May 2014 в 13:07
поделиться