gpt4 book ai didi

iOS 7 - region.center 弃用

转载 作者:可可西里 更新时间:2023-11-01 03:23:11 28 4
gpt4 key购买 nike

我的 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 已被弃用。我应该使用替代品吗?这甚至是在 View 中创建 map 的正确方法吗?

谢谢!!

最佳答案

试试这个:

region.center = [(CLCircularRegion *)placemark.region center];

关于iOS 7 - region.center 弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19187525/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com