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
我爲什麼不能設置標題和副標題在這裏?