ios - GLKViewController orientation animation -


i have layout, screen divided 2 parts: uiview @ top , glkviewcontroller @ bottom. problem when screen orientation changes glkviewcontroller part rotated , gradually stretched out until animation finishes, @ point new unstretched frame drawn.

is there way disable automatic rotation animation glkviewcontroller, animate manually manipulating modelview-projection matrix?

if you're looking deal stretching effect, don't need replace whole orientation/rotation system. depending on how you're making use of device orientation in you're app's ui, you're cause more maintenance headaches reimplementing orientation , rotation. (if need more work around stretching effect, other answers still good.)

your view drawing during rotation animation, need ensure it's drawing in way matches intermediate size during animation. rotation animation handled core animation, use presentationlayer method access transitory state during animation. example:

calayer *presentationlayer = [self.view.layer presentationlayer]; cgsize layersize = presentationlayer.bounds.size; float aspect = fabsf(layersize.width / layersize.height); glkmatrix4 projectionmatrix = glkmatrix4makeperspective(     glkmathdegreestoradians(65.0f), aspect, 0.1f, 100.0f); 

run snippet part of update/draw loop — note might mean moving calculation of projection matrix update/draw loop if isn't there already. (you might want make sure snippet runs every frame if orientation change in progress.)

to see animation in progress , make sure it's working right, use "toggle slow animations" command in ios simulator.

(credit due: code this answer.)


Comments

Popular posts from this blog

Why can rails not find a route created by a helper? -

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -