我能够成功地向用户显示其在MapView上的当前位置。但是,当我转到另一个视图控制器并返回到我的地图视图时,我看到一个蓝色屏幕。为什么?MkMapView显示蓝色屏幕
这是我的代码:
- (void)viewWillAppear:(BOOL)animated {
MyManager * myManager = [MyManager sharedInstance];
//if coming back from another screen, lets load the coordinates
if (myManager.centerOfMap) {
NSLog(@"myManager.centerOfMap has a value:");
self.centerOfMap = myManager.centerOfMap;
}
CLLocationCoordinate2D zoomLocation;
zoomLocation = *(self.centerOfMap);
MKCoordinateRegion viewRegion = MKCoordinateRegionMakeWithDistance(zoomLocation, 0.5*METERS_PER_MILE, 0.5*METERS_PER_MILE);
MKCoordinateRegion adjustedRegion = [_mapView regionThatFits:viewRegion];
[_mapView setRegion:adjustedRegion animated:YES];
}
这个蓝色屏幕实际上是大海。不要与Windows蓝色屏幕混淆,你想把你的电脑扔进大海。 – yinkou 2012-07-20 20:46:51