为什么用属性声明在接口上声明公共属性变量?

时间:2019-02-27 17:55:29

标签: objective-c

我正在查看下面的这段代码,试图找出我们两个人中的哪一个...(我或编写它的人)不知道他们在做什么。

为什么他/她先声明属性,然后又声明匹配的变量? 我不能问这个人,因为这个项目是从一个早已消失的小组中继承下来的。

@interface LayerList : UIViewController <UITableViewDataSource, UITableViewDelegate>
    {
        UITableView *tvList;
        ArcGisViewController *mapController;
        NSArray *fileList;
    }

    @property (nonatomic, strong) IBOutlet UITableView *tvList;
    @property (nonatomic, strong) ArcGisViewController *mapController;
    @property (nonatomic, strong) NSArray *fileList;

    -(void)visibleSwitchValueChanged:(id)sender;

    -(IBAction) Cancel;
@end

1 个答案:

答案 0 :(得分:1)

这是一天中通常的方式,在引入自动合成之前,您必须手动synthesize设置属性。