ios - UILabel redraws the view. How to avoid this behavior? -


i have viewcontroller 3 subviews. use autolayout , size classes. these views animated , change location , size. after animations update label whole view redrawn each view in initial position , size. shouldn't happen. in apple developer reference says:

"the default content mode of uilabel class uiviewcontentmoderedraw. mode causes view redraw contents every time bounding rectangle changes. can change mode modifying inherited contentmode property of class."

it doesn't seem clear me how modify -contentmode- in order update label , leave view -as is-. can give me clue? in advance.

it sounds may using autolayout lay out view (e.g., via constraints in ib), you're manipulating views' frames directly animations - case? if so, should instead animating constant values of constraints, or possibly transforms of subviews.

if manipulate frames directly in view uses autolayout, changes over-written next time system lays out view (e.g. after label's text changes).

you have 3 options overcome issue -

  1. stop using autolayout in storyboard/xib.

    not great solution

  2. animate changes transform property of subviews. e.g. myview.transform = cgaffinetransformmakescale(2.0,2.0);

    useful presentation , dismissal animations, mixing autolayout , transforms has issues pre-ios 8.0

  3. add iboutlets constraints need change in animations. animate changes constant values of constraints.

    most robust approach can lead lot of properties , code complex animations


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -