私は次のコードを持っています:
-(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;
2 つの質問がありました。
- 読み取り専用のプロパティに割り当てても問題ありませんか?
- その前にすべきではありません
coordinate
かself
?(例:self.coordinate = c
)。
ps。このコードを使用してもエラーは発生しません。これは本の例です。