我的 iOS 应用程序有以下代码:
NSString *location = [[NSString alloc] initWithFormat:@"%@, %@", [self.campus campusStreetAddress], [self.campus campusCityStateZip]];
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];
MKCoordinateRegion region = self.campusMap.region;
region.center = placemark.region.center; //DEPRECATED iOS 7
region.span.longitudeDelta /= 1500;
region.span.latitudeDelta /= 1500;
[self.campusMap setRegion:region animated:NO];
[self.campusMap addAnnotation:placemark];
}
}
];
但是,当我将我的应用程序升级到 iOS 7 时,placemark.region.center 已被弃用。我应该使用替代品吗?这甚至是在视图中创建地图的正确方法吗?
谢谢!!