Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Weird animation behaviour while using autolayout in .xib

I've a custom tableview cell with a right aligned button having following constraints:

  1. Trailing space from superview
  2. Fixed width
  3. Fixed height
  4. Top space from superview

enter image description here

Now when I launch my view controller, this edit icon image fly and settle down at the correct location. How can I remove that animation.

NOTE: This problem is in visible only in certain cells. I've also tried deleting and re-adding the component as well.

like image 252
Bhanu Birani Avatar asked May 11 '15 13:05

Bhanu Birani


2 Answers

Fixed the problem by updating the frame and then calling the [self layoutIfNeeded]; Nothing will work if you miss [self layoutIfNeeded]; function call after updating your frames.

like image 75
Bhanu Birani Avatar answered Nov 15 '22 15:11

Bhanu Birani


While working with autolayout, you should always call [self layoutIfNeeded]; after updating the frame.

like image 45
Abhishek.Vyas Avatar answered Nov 15 '22 15:11

Abhishek.Vyas