ios - Animation: Using Autolayout, Frame.Origin & Broken Constraints, Or 3rd Option? -


i've used auto layout build app layouts adapt iphone , ipad models. auto layout important. however, have keyframe automation view needs animate different location. achieved getting location of other view:

let last_pos = destinationimg.superview?.convertpoint(destinationimg.frame.origin, toview: nil) 

and doing keyframe animation in frames set new coordinates, example:

myview.frame.origin.x = targetviews_lastpos!.x 

this breaking auto layout constraints though. i've read , know many people suggest animating change in auto layout constraints (instead of frame position). isn't there better way? doing nightmare uiview i'm animating has set of complex constraints set right:

enter image description here

and view who's location i'm targeting unrelated (they're nested in different superviews). wouldn't require ton of code create animation can in couple of lines frame.origin? , note, make view disappear after reaches destination it's temporary position anyhow. messing 15 constraints seems nuts.

how people handling nightmare of animating uiviews have complex auto layout constraints??

you not going answer if want animate 1 thing, not worth use external libraries, make easily. rethinking layout animation. means try make layout i'll have change 1 constant of 1 constraint make animate nicely. means you'll have work on how make view independent , not relying other views. i'm used to. think of animations want, , design layout constraints. @ end it's easier animations animate constraints, if have done things won't have move every views hands, calculate should , put magic numbers, auto layout you.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -