gpt4 book ai didi

ios - 如何在iOS 7中缩小mkmapview的负载

转载 作者:行者123 更新时间:2023-12-01 18:17:58 24 4
gpt4 key购买 nike

我拥有的这段代码适用于iOS 6,但似乎对iOS 7无效。如何设置跨度不起作用时,如何使其适用于iOS 7?

CLLocationCoordinate2D  ctrpoint = self.location.coordinate;


MapPoint *mp = [[MapPoint alloc] initWithCoordinate:ctrpoint title:[NSString stringWithFormat:@"%@: %@",NSLocalizedString(@"Pin Name:", @"Pin Name:"),self.pin.name] subtitle:self.pin.cell];
[self.mapView addAnnotation:mp];



MKCoordinateSpan span;

span.latitudeDelta = 0.2;
span.longitudeDelta = 0.2;

MKCoordinateRegion region;
region.span = span;
region.center = self.location.coordinate;

[self.mapView setRegion:region animated:YES];

最佳答案

正确的方法是使用提供的常量:

- (MKCoordinateRegion)regionForWorld {
return MKCoordinateRegionForMapRect(MKMapRectWorld);
}

所以
- (void)zoomToWorldAnimated:(BOOL)animated {
MKCoordinateRegion region = [self regionForWorld];
[self.mapView setRegion:region animated:animated];
}

关于ios - 如何在iOS 7中缩小mkmapview的负载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19837927/

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