Navigation Controller in landscape with Storyboard [iPhone] - iphone

I'm working with Navigation Controller in my storyboard, but my application is always in portrait format when I put the simulator in landscape. Why? =(

Change
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
To
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
Also make sure in your project settings you have 'Supported Device Orientations' set to allow Landscape.

Related

shouldAutorotateToInterfaceOrientation won't respect my wishes

(Using Storyboard)
I'm trying to make one of my ViewController Subclasses support more than just portrait view.
I've added in
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationPortrait));
}
but it doesn't seem to do anything. I've got all orientations except upsidedown supported in my plist, and added the shouldautorotate to allow only portrait in the viewcontrollers that I want.
The method you're looking for in ios6 is - (NSUInteger)supportedInterfaceOrientations
This essentially replaced shouldAutorotate. Use it in conjunction with shouldAutorotate.

Landscape app for ipad doesn't have home screen landscape

I am creating landscape app for iPad, but when I run the application I found the home screen displays as portrait. How can I solve it?
Select the target, in that select only Landscape Left and Landscape Right option in "Supported Device Orientations. And also in your roo view controller set
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if(UIInterfaceOrientationIsLandscape(interfaceOrientation))
return YES;
return NO;
}
Ensure your app only supports landscape orientations in your Project Settings (unselect 'Portrait' and 'Upside Down'):
View Controllers that support landscape should say they do, too:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
add this methord
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
NSLog(#"Changed interface orientation");
return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight)
);
}

Supported orientations not limiting actual orientations

I have an iPad game that I only want to see in landscape view. I have selected the landscape view from the target's summary and have the code
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return YES;
}
in my first viewcontroller which is added to a navController. But the only effect that I can see by changing the target's orientations is not how it can be rotated but rather what direction it is first loaded in. Does anyone have any ideas? Thanks!
Try this:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

iPhone supported orientations in Xcode

I've set in plist that it should only support portrait mode, but when I rotate it the view changes. It worked for me before, but not now...
Please help, it's driving me crazy!
Vedran Burojević,
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait)
}
the above code only support portrait mode..
you can write the code in this.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait)
}

UIStatusbar changes orientation, but everything else stays the same

I have a tabbar app, with some uinavigationcontrollers.
In every VC i have:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
But for some reason when rotating the screen the status bar rotates, but the rest of my view stays the same. How can I fix this?
Try adding this to your info.plist
shouldAutorotateToInterfaceOrientation: would normally be implemented like this (for an iPhone app that supports rotation):
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
It's not clear from your question whether you want the subviews to rotate or the status bar to not rotate.