2
我在设置标题和字幕的问题我的地标。iOS - MKPlacemark集标题问题
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
[geocoder geocodeAddressString:location
completionHandler:^(NSArray* placemarks, NSError* error){
if (placemarks && placemarks.count > 0) {
CLPlacemark *topResult = [placemarks objectAtIndex:0];
MKPlacemark *placemark = [[MKPlacemark alloc] initWithPlacemark:topResult];
placemark.title = @"Some Title";
placemark.subtitle = @"Some subtitle";
MKCoordinateRegion region = self.mapView.region;
region.center = placemark.region.center;
region.span.longitudeDelta /= 8.0;
region.span.latitudeDelta /= 8.0;
[self.mapView setRegion:region animated:YES];
[self.mapView addAnnotation:placemark];
}
}
];
placemark.title = @"Some Title";
和placemark.subtitle = @"Some subtitle";
给我的错误:
Assigning to property with 'readonly' attribute not allowed
我为什么不能设置标题和副标题在这里?