1
votes

I use

[UIView beginAnimations:nil context:NULL];

to animate a UIViewController's frame. That view controller includes a UITableView and that UITableView's cells are custom subview which also has autoresizing mask set.

While animating the parent viewcontroller, changes in frame causes animation also for that cell contents which is expected but not what I wanted. I want those cells to immediately set their new frame and I want the whole viewcontroller content to move (animate) as a block, not as independent objects.

I can not specifically set frame for inner contents as this is not the single viewcontroller. There are 7 viewcontrollers which are animated (sliding animation)

PS: I am not looking for an alternative component for transition of viewcontrollers, as I am doing custom animation.

Is there a way to stop animations for autoresizing operations for a specific UIView or UIViewController?

Update

Using transitionWithView still causes subviews to animate with autoresizing. Stack trace:

+[UIView(UIViewAnimationWithBlocks) transitionWithView:duration:options:animations:completion:] ()
+[UIView(UIViewAnimationWithBlocks) _setupAnimationWithDuration:delay:view:options:factory:animations:start:animationStateGenerator:completion:] ()
-[UIView(Geometry) _applyAutoresizingMaskWithOldSuperviewSize:] ()
-[UIView(Geometry) setFrame:] ()
1
can u calculate new values for subviews frames before animation ended?Oleg Sobolev
look at my updated answer.Oleg Sobolev

1 Answers

0
votes

Ok. Here my insane thoughts:

1) Add all subviews to array

2) Remove all subviews from superview

3) Create new view same size as old and make her transparent

4) Add all subviews from array to new view

5) Apply animation to new view with duration 0 (subviews will resize immediately)

6) Apply animation to old view with you need duration

7) Move subviews back to old view when animation from step 6 did ended