How to get current zoom level from google map for ios? -
i use method camera digital value this:
camera = [gmscameraposition camerawithlatitude:37.35 longitude:-122.0 zoom:6];
and need automatically redraw map current position via timer:
-(void)gmapredraw{ nslog(@"gmapredraw"); // self.mapview.camera [locationmanager startupdatinglocation]; nslog(@"lat %f, lon %f", locationmanager.location.coordinate.latitude, locationmanager.location.coordinate.longitude); camera = [gmscameraposition camerawithlatitude:locationmanager.location.coordinate.latitude//37.36//-37.81319//-33.86 longitude:locationmanager.location.coordinate.longitude//-122.0//144.96298//151.20 zoom:6]; self.mapview.camera = camera; } -(void)timer{ [nstimer scheduledtimerwithtimeinterval:0.5 target:self selector:@selector(gmapredraw) userinfo:nil repeats:yes]; }
but how can current zoom if change via touch?
ok, find solution, current zoom:
cgfloat currentzoom = self.mapview.camera.zoom;
and use in camera:
camera = [gmscameraposition camerawithlatitude:locationmanager.location.coordinate.latitude longitude:locationmanager.location.coordinate.longitude zoom:currentzoom]; self.mapview.camera = camera;
Comments
Post a Comment