我能夠成功地向用戶顯示其在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