-1

使用纬度和经度我想通过注释显示正确的位置。我的应用程序正在显示该区域,但没有通过注释显示正确的位置。

这是我的代码:

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

1 回答 1

0

You have set the region for your map but not the annotation.

For blue dot you need to add annotation for the same latitude and logitude. Add following code with yours.

MapPoint *mp = [[MapPoint alloc] initWithCoordinate:**YouReagionsCordinat** title:@"**yourLocation**"];

[mapView addAnnotation:mp];

If still you are stucking then go through This tutorial .

于 2013-10-30T10:28:40.780 回答