我试图表明我的当前位置在Mapkit这是代码CoreLocation,MapKit错误
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
//Make this controller the delegate for the map view.
self.MapView.delegate = self;
// Ensure that you can view your own location in the map view.
[self.MapView setShowsUserLocation:YES];
locationManager = [[CLLocationManager alloc] init];
[locationManager setDelegate:self];
[locationManager setDistanceFilter:kCLDistanceFilterNone];
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
}
,我写了这个委托的Mapkit
#pragma mark - MKMapViewDelegate methods.
- (void)mapView:(MKMapView *)mv didAddAnnotationViews:(NSArray *)views {
MKCoordinateRegion region;
region = MKCoordinateRegionMakeWithDistance(locationManager.location.coordinate,2000,2000);
[mv setRegion:region animated:YES];
}
,但我得到错误的位置荫在埃及和这给美国Iam在美国 任何一个可以帮我ME?
如何将它设置到埃及? – user1752619
你必须输入你的位置的经度和纬度。所以,启动模拟器,去调试 - >位置 - >自定义位置,并将其设置为30.2,31.5 – Nicholas
BIG谢谢尼古拉斯:) 我做这个,它显示我在地图上埃及但不是当前位置 – user1752619