read

You need to add (don’t avoid anyone) supportedInterfaceOrientations, shouldAutorotate and preferredInterfaceOrientationForPresentation for IOS 6, and for IOS < 6 shouldAutorotateToInterfaceOrientation and willRotateToInterfaceOrientation.

<pre style="background-color: #f0f0f0; background-position: initial initial; background-repeat: initial initial; border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"> #pragma mark - Rotation IOS >= 6

- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskPortrait;
}

- (BOOL)shouldAutorotate{
return YES;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationPortrait;
}

#pragma mark - Rotation IOS < 6

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{
return YES;
}

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
duration:(NSTimeInterval)duration{

// To avoid nav bar and view moved on rotation
[UIApplication sharedApplication].statusBarHidden = NO;</pre><div style="background-color: white; font-family: arial, sans-serif; font-size: 13px;">       self.navigationController.navi</wbr>gationBar.hidden = YES;</div><div style="background-color: white; font-family: arial, sans-serif; font-size: 13px;">       self.navigationController.navi</wbr>gationBar.hidden = NO;</div><div class="yj6qo ajU" style="background-color: white; color: #222222; cursor: pointer; font-family: arial, sans-serif; font-size: 13px; margin: 2px 0px 0px; outline: none; padding: 10px 0px; width: 22px;"></div><pre style="background-color: #f0f0f0; background-position: initial initial; background-repeat: initial initial; border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;">
}
</pre>
The red line is used to avoid status bar orientation change the bounds and frame of the actual UIViewController View, sometimes the Video in full screen make wear things on that…

Blog Logo

Daniel Gomez Rico


Published

Image

MakinGIANTS

The findings and tips records of an Android-iOS-TheWholeShabang group

Back to Overview