2013-02-08 61 views
0

我使用ADClusterMapView作为mapview,当我添加一个[self.mapView setRegion:region animated:YES]时,除了模拟器中的蓝色屏幕外,我什么都看不到。没有这行代码,我可以看到地图。我很确定我可以获得与locationController.locationManager.location.coordinate的坐标。当它在模拟器中运行时,我所能看到的只是一个绿色屏幕和左侧底部的Legal链接,右侧底部是一个Autonavi。mapView setRegion:在模拟器中没有任何东西显示

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 
    if ([CLLocationManager locationServicesEnabled]) { 
     self.mapView.delegate = self; 

     locationController = [[LocationController alloc] init]; 
     [locationController.locationManager startUpdatingLocation]; 

     MKCoordinateRegion region; 
     region = MKCoordinateRegionMakeWithDistance(locationController.locationManager.location.coordinate, 10000, 10000); 
     [self.mapView setRegion:region animated:YES]; 
    } 
} 
+0

属性'showUserLocation'是否启用? – CainaSouza 2013-02-08 13:28:49

+0

此外,请确保您的模拟器正在仿真调试>位置 – CainaSouza 2013-02-08 13:32:26

+1

中的任何位置。这已被询问并回答了太多次。调用startUpdatingLocation后,您无法期望检索位置_immediately_。您必须使用didUpdateToLocation/didUpdateLocations委托方法。 – Anna 2013-02-08 13:35:14

回答

1

确保在模拟运行应用程序时选择当前位置。

enter image description here