ios - UIScrollview centre translates when zoom in. Is it a bug? -
ios - UIScrollview centre translates when zoom in. Is it a bug? -
i drawing graph graph scales on zooming in. graph view contentview of scrollview. have graph axis view placed under graphview (having same width) regular uiview manage positioning of labels on view myself according zoom scale , panning. found label positioning not syncing graph content correctly (while zooming). redraw content after zooming ends.
apple docs zooming occurs around visible content
zooming programmatically if visible content same size of frame, contentview center should not move, found in -(void)scrollviewdidzoom:(uiscrollview *)scrollview method nsloging contentview center moves in +ve x(to right)slightly zoom-in more , more. expected remain stationary.is bug or missing ?
ps: understand if size of contentview less visible bounds of scrollview, center drift left (towards origin).
i posted question in apple dev forums , got right response makes sense.
here is: remember, center derived 0x x 0y, not bounds proper. when zooming, can nail 1 bound before nail other, reference them freeze center when 1 maxed out. if zoom calculated off top left/right you'll see center them instead regardless
this means center recalculated top left (0,0) (i verified this).
cgpoint newcentre = cgpointmake(oldcentre.x*scale, oldcentre.y*scale);
and reason drifts forwards little bit
ios uiscrollview zooming
Comments
Post a Comment