mapView setRegion:region在模拟器中不显示任何内容

时间:2013-02-08 13:23:53

标签: iphone mapkit cllocationmanager

我使用ADClusterMapView作为mapview,当我添加[self.mapView setRegion:region animated:YES]时,我在模拟器中看不到任何东西而是蓝屏。没有这行代码,我可以看到地图。我很确定我可以通过locationController.locationManager.location.coordinate获得坐标。当它在模拟器中运行时,我只能看到绿色屏幕和左下角的Legal链接以及右下角的Autonavi。

- (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];
    }
}

1 个答案:

答案 0 :(得分:1)

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

enter image description here