strange strange - 1 year ago 102
iOS Question

Rotation methods deprecated, equivalent of 'didRotateFromInterfaceOrientation'?

I'm trying to implement the new

method which has been introduced in iOS 8 (all other rotation methods have been deprecated). I'd like to know what the equivalent of
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
in order to be called when 'transition' to a new size finishes. Thanks.

Answer Source

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];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download