ios - GMSGroundOverlay animating - should I be using a CATiledLayer? -
i experimenting google maps ios sdk latest version 1.2.1.2944 animate gmsgroundoverlay
. user has control on image sequence, using animated uiimage
isn't possibility sadly, i'm loading in uiimage
on fly. gmsgroundoverlay.icon
set uiimage
being updated.
aside high memory usage, seem have struck limitation in whenever try overlay uiimage
using gmsgroundoverlay.icon
more 1000px x 1000px, crashes. referencing uiimage
of 1000px x 1000px gets around crash.
it strikes me though maybe should utilise catiledlayer
handling image load memory , subsequently icon property of gmsgroundoverlay
, has had experience of using catiledlayer
google maps ios sdk , sequencing images animated gmsgroundoverlay
?
i got answer pressinganswer.com, think may helps you.
as cannot use "position" keypath animating, ended animating using "latitude" , "longitude" keypaths separately.
first calculate points , add them 2 separate arrays, 1 latitude value (y) , 1 longitude (x) , use values property in cakeyframeanimation animate. create 2 cakeyframeanimation objects (1 each axis) , group them using caanimationgroup , animate them form circle.
in equation vary length of radius on each axis can generate oval path.
nsmutablearray *latitudes = [nsmutablearray arraywithcapacity:21]; nsmutablearray *longitudes = [nsmutablearray arraywithcapacity:21]; (int = 0; <= 20; i++) { cgfloat radians = (float)i * ((2.0f * m_pi) / 20.0f); // calculate x,y coordinate using angle cgfloat x = hdist * cosf(radians); cgfloat y = vdist * sinf(radians); // calculate real lat , lon using // current lat , lon center points. y = marker.position.latitude + y; x = marker.position.longitude + x; [longitudes addobject:[nsnumber numberwithfloat:x]]; [latitudes addobject:[nsnumber numberwithfloat:y]]; } cakeyframeanimation *horizontalanimation = [cakeyframeanimation animationwithkeypath:@"longitude"]; horizontalanimation.values = longitudes; horizontalanimation.duration = duration; cakeyframeanimation *verticleanimation = [cakeyframeanimation animationwithkeypath:@"latitude"]; verticleanimation.values = latitudes; verticleanimation.duration = duration; caanimationgroup *group = [[caanimationgroup alloc] init]; group.animations = @[horizontalanimation, verticleanimation]; group.duration = duration; group.repeatcount = huge_valf; [marker.layer addanimation:group forkey:[nsstring stringwithformat:@"circular-%@",marker.description]];