使用纬度和经度在谷歌地图上找到正确的位置
问题描述:
使用纬度和经度我想通过注释显示正确的位置。我的应用程序正在显示该区域,但没有通过注释显示正确的位置。使用纬度和经度在谷歌地图上找到正确的位置
这里是我的代码:
-(void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.mapView.delegate=self;
[self.mapView setShowsUserLocation:YES];
locatinmanager=[[CLLocationManager alloc]init];
[locatinmanager setDelegate:self];
[locatinmanager setDistanceFilter:kCLDistanceFilterNone];
[locatinmanager setDesiredAccuracy:kCLLocationAccuracyBest];
}
#pragma mark - MKMapViewDelegate methods.
- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views {
MKCoordinateRegion region;
region.center.latitude=13.0839;
region.center.longitude=80.2700;
[mapView setRegion:region animated:YES];
}
答
您已设置区域的地图,但没有注释。
对于蓝点,您需要为相同的纬度和经度添加注释。 添加以下代码与您的。
MapPoint *mp = [[MapPoint alloc] initWithCoordinate:**YouReagionsCordinat** title:@"**yourLocation**"];
[mapView addAnnotation:mp];
如果你仍然是stucking然后再通过This tutorial 。
在这里我想添加这个 – user2756361
加上 [mapView setRegion:region animated:YES]; 在您的代码 –
如何设置mapPoint先生的财产声明 – user2756361