0

我在接口文件中有以下代码:

#import <UIKit/UIKit.h>
#import <AddressBook/AddressBook.h>
@class FaxRecipient;

//Definition of the delegate's interface
@protocol AddLocalRecipientsTableViewControllerDelegate
-(void)getLocalRecipient:(FaxRecipient*)recipient;
@end

@interface AddLocalRecipientsTableViewController : UITableViewController {
    NSMutableArray *localRecipientItems;
    NSURLConnection *connectionInprogress;
    UIActivityIndicatorView *activityIndicator;
    NSIndexPath *lastIndexPath;
    FaxRecipient * faxRecipient;
}

@property(nonatomic,retain) NSIndexPath *lastIndexPath;
@property(nonatomic,retain)FaxRecipient * faxRecipient;
@property (nonatomic, assign) id<AddLocalRecipientsTableViewControllerDelegate> delegate;


-(void) loadLocalRecipients;

我的实现文件中有以下行:

@synthesize delegate=_delegate;

带下划线的综合是什么意思?我的意思是我知道常规合成器的作用。一切正常,我在其他站点查看了此代码示例。

4

1 回答 1

0

您的属性几乎总是有一个支持变量。什么

@synthesize delegate=_delegate;

确实是声明搜索栏的支持变量将被称为_searchBar。这允许您将属性名称与变量名称分离。事实上,如果你不使用@synthesize,你根本不需要支持变量。

这个可以:

  1. 避免与变量名冲突和
  2. 当我使用局部变量和使用实例变量时要清楚。
于 2011-06-12T18:14:03.673 回答