I am trying to reproduce the behavior of iTunes 11 in navigation views inside a popover. I cannot find a way to make my animation happen at the same time as the popover changes contentSize.
I have a basic setup - this is a subclass of the MyPopoverNavigationView subroutine with two areas: old and new views, which I want the popover to move between. Popover contentViewControllerhas an instance of MyPopoverNavigationView in quality view. I'm doing it:
[NSAnimationContext runAnimationGroup:^(NSAnimationContext *ctx) {
[ctx setDuration:0.25];
[ctx setAllowsImplicitAnimation:YES];
[self layoutSubtreeIfNeeded];
} completionHandler:nil];
As far as I can tell from the Auto Layout WWDC 2012 videos, this is the recommended way to animate changes in view frames as a result of changes in constraints. It works, but the animation takes place in two stages:
- Firstly, the popover
contentSizewill change to accommodate the new view Iβm moving on to (before this view becomes visible, so it partially obscures the existing content). - Secondly, the views are waiting, as I expect, so the system of restrictions that I set is fulfilled.
From setting some breakpoints, it looks like it -layoutSubtreeIfNeededultimately invokes a private method in popover called _fromConstraintsSetWindowFrame:that does popover size animation outside my animation group. The duration of my context is not respected, and my animations do not happen until the resize popover is complete.
How can I get my views for animation along with resizing popover?
source
share