Search code examples
iosobjective-cmarkerbaidu-map

how to set marker at my current location and change camera position in Baidu Map (objective c)


I configure Baidu map in my code using pod 'BaiduMapKit' and display map in view. how to set a marker at my current location in Baidu Map and change camera position also?

// now I solve how to set marker but actually my camera location not move.

- (void)viewDidLoad {
           [super viewDidLoad];
           anotation = [[BMKPointAnnotation alloc]init];
           CLLocationCoordinate2D coor;

           coor.latitude  = 22.2593;
           coor.longitude  = 70.7777;
           anotation.coordinate = coor;
           anotation.title  = @"this is rajkot";
           [mapView addAnnotation:anotation];
           mapView.delegate = self;

     }

Solution

  • CLLocationCoordinate2D coor;
    coor.latitude  = 22.2593;
    coor.longitude  = 70.7777;
    mapView.centerCoordinate = coor
    

    try this to change the camera