【发布时间】:2011-08-05 06:35:03
【问题描述】:
可能重复:
Prefixing property names with an underscore in Objective C
我是一名 C/C++ 开发人员,正在学习 Objective-C。最近我开始学习我在网上找到的教程。代码如下:
@interface MapDemoAnnotation : NSObject <MKAnnotation> {
CLLocationCoordinate2D _coordinate;
}
- (id)initWithCoordinate:(CLLocationCoordinate2D)coordinate;
@end
@implementation MapDemoAnnotation
@synthesize coordinate=_coordinate;
- (id)initWithCoordinate:(CLLocationCoordinate2D)coordinate {
self = [super init];
if (self != nil) {
_coordinate = coordinate;
}
return self;
}
@end
谁能解释一下这句话的意思
@synthesize coordinate=_coordinate;
我知道@synthesize 的含义。但无法理解完整的陈述。
_coordinate 是一个成员变量。但是coordinate 是什么?它在哪里声明?
【问题讨论】:
标签: iphone objective-c