strange strange - 20 days ago 5
iOS Question

Rotation methods deprecated, equivalent of 'didRotateFromInterfaceOrientation'?

I'm trying to implement the new

viewWillTransitionToSize
method which has been introduced in iOS 8 (all other rotation methods have been deprecated). I'd like to know what the equivalent of
didRotateFromInterfaceOrientation
is now as there are a number of clean up tasks we need to perform and I can't see a block that we can assign to
UIViewControllerTransitionCoordinator
in order to be called when 'transition' to a new size finishes. Thanks.

Answer

Okay found it, just have to use the animateAlongsideTransition:completion: method on the passed UIViewControllerTransitionCoordinator.

- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{   
    [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context)
    {
        UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];
        // do whatever
    } completion:^(id<UIViewControllerTransitionCoordinatorContext> context)
    { 

    }];

    [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
}