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.
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]; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With