Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 869
strange Avatar asked Jun 05 '14 22:06

strange


Video Answer


1 Answers

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]; } 
like image 56
strange Avatar answered Sep 19 '22 21:09

strange