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' frame
s directly animations - case? if so, should instead animating constant
values of constraints, or possibly transform
s 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 -
stop using autolayout in storyboard/xib.
not great solution
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
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
Post a Comment