0

I am using Google Maps in iOS. I have added map in subview. But animateToLocation method doesn't work although it works fine if I assign mapView to whole view with

self.view = mapView_

[mapView_ animateToLocation:CLLocationCoordinate2DMake(-33.868, 151.208)];
Kampai
  • 22,848
  • 21
  • 95
  • 95
Ahad Khan
  • 411
  • 2
  • 18

2 Answers2

0

I found solution by change outlet type GMSMapView and setting camera in viewDidLoad method.

in .h file

@property (weak, nonatomic) IBOutlet GMSMapView *mapView;

in viewDidLoad

GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86  longitude:131.20   zoom:6];
self.mapView.camera = camera;
Ahad Khan
  • 411
  • 2
  • 18
0

You can try out the following code:

- (void)viewDidLoad
{
    [super viewDidLoad];
    GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.86
                                                        longitude:131.20
                                                             zoom:6];

    self.map1.camera = camera;
AniV
  • 3,997
  • 1
  • 12
  • 17