Google maps for ios probleam -
i learning develop ios. using google maps api ios map. i've putted in project view i've putted in inspector element gmsmapview.
in code put code below:
- (void) setmapview:(gmsmapview *)mapview { if (!mapview) { mapview = [[gmsmapview alloc] initwithframe:mapview.bounds]; } googlemap = mapview; }
the map works want set camera on map. on viewdidload
function i`ve putted code below:
gmscameraposition *camera = [gmscameraposition camerawithlatitude:-33.8683 longitude:151.2086 zoom:12]; self.mapview = [gmsmapview mapwithframe:cgrectzero camera:camera];
but google maps load map on london don't know why. ths coordinates sidney. have tried googlemap = [gmsmapview mapwithframe:cgrectzero camera:camera];
don't works too.
anybody can me?
i had same problem. can fix animating camera position once map has been allocated. added delay before animating new camera position. works.
- (void)viewdidload { self.mapview = [[gmsmapview alloc] initwithframe:cgrectmake(0, 0, 320, 480)]; // frame double delayinseconds = 0.2; dispatch_time_t poptime = dispatch_time(dispatch_time_now, (int64_t)(delayinseconds * nsec_per_sec)); dispatch_after(poptime, dispatch_get_main_queue(), ^(void){ gmscameraposition *camera = [gmscameraposition camerawithlatitude:-33.8683 longitude:151.2086 zoom:12]; [self.mapview animatetocameraposition:camera]; }); }
Comments
Post a Comment