这有点奇怪,但我已经连续 2 天试图找到一个解决方案来设置地图区域,但似乎没有任何效果这是我的代码:
-(void)viewWillAppear:(BOOL)animated{
//[self step1locationupdate];
Maplocation.showsUserLocation=YES;
MKCoordinateRegion mapRegion;
mapRegion.center.longitude=self.currentProduct.shop.longcoordinate;
mapRegion.center.latitude=self.currentProduct.shop.latcoordinate;
NSLog(@"The USer Location are :%f",mapRegion.center.latitude);
mapRegion.span.latitudeDelta= 2;
mapRegion.span.longitudeDelta= 2;
[Maplocation setRegion:mapRegion animated:YES];
NSLog(@"The USer Location are :%f %f",Maplocation.userLocation.coordinate.latitude,Maplocation.userLocation.coordinate.longitude);
}
启动时,malocation.userlocation.coordinate 的 NSLog 始终为 0。我已将其添加到 viewDidLoad 部分中的相同代码也没有区别
请帮助