I know that you need to use the new rotation methods for iOS6, but it seems that the method I wrote does not work.
I set my plist file to allow all rotations, but not portraitUpsideDown
Then I had the following in appDelegate :
self.navController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
[self.window setRootViewController:navController];
Then in my root element, to click on another controller, I have:
WebViewViewController *webController = [[JBWebViewViewController alloc] init];
webController.urlString = urlName;
[self.navigationController pushViewController:webController animated:YES];
And in the web controller, I have:
#pragma mark - System Rotation Methods
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
/for 6.0+
- (BOOL)shouldAutorotate{
return NO;
}
- (NSUInteger)supportedInterfaceOrientations{
return UIInterfaceOrientationMaskPortrait;
}
What I want to do is allow 3 rotations in the root view, but when switching to the web view (note that I click navigation and not add subview), I only want to allow portrait view.
Someone helps me
------- UPDATE ----------
NavController UINavigationController, BOOL landscapeModeOn, ,
#pragma mark - System Rotation Methods
- (BOOL)shouldAutorotateToInterfaceOrientation (UIInterfaceOrientation)interfaceOrientation
{
if (landscapeModeOn) {
return interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown;
} else {
return interfaceOrientation == UIInterfaceOrientationPortrait;
}
}
- (NSUInteger)supportedInterfaceOrientations{
if (landscapeModeOn) {
return UIInterfaceOrientationMaskAllButUpsideDown;
} else {
return UIInterfaceOrientationMaskPortrait;
}
}
- (BOOL)shouldAutorotate{
UIInterfaceOrientation ori = [UIDevice currentDevice].orientation;
if (landscapeModeOn) {
return ori != UIInterfaceOrientationPortraitUpsideDown;
} else {
return ori == UIInterfaceOrientationPortrait;
}
}
subviews :
- (void)viewWillAppear:(BOOL)animated{
JBNavController *navController = (JBNavController*)self.navigationController;
[navController setLandscapeModeOn:NO];
[navController shouldAutorotate];
}
-------------------- .
IOS6 Apple Storyboard AutoLayout , IOS6 ios 4.3 ios 5
applefreak, :
.
, , , , , .