I need to instantly and without rotation animation change the screen orientation (and accordingly the size of the frame self.view
in the UIViewController
). If I do it like this in UIViewController
:
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
[super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
[CATransaction begin];
[CATransaction setDisableActions:YES];
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
[self.view setFrame:CGRectMake(0, 0, size.width, size.height)];
} completion:^(id<UIViewControllerTransitionCoordinatorContext> context) {
[CATransaction commit];
}];
}
Then, at the moment the screen orientation changes to, I see a flickering of view. How can I do what is necessary?