-(id) initWithCoordinate:(CLLocationCoordinate2D)c title:(NSString *)t
{
self = [super init];
if (self)
{
coordinate = c;
self.title = t;
}
return self;
}
其中coordinate
是:
@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
我有两个问题:
- 将只读属性赋值是否可行?
coordinate
在前面不应该加上self
吗?(例如:self.coordinate = c
)。
ps. 我使用这段代码没有任何错误——它是一本书中的例子。