Landscape app for ipad doesn't have home screen landscape - iphone

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)
);
}

Related

Only statusbar is rotating to Landscape (iPhone)

In One of my Viewcontroller that supports only Portrait orientation. On my
device when rotate the status bar is rotating to landscape
orientation. The rest of the view remains in Portrait mode. I want to prevent the roation of statusbar. This
problem is happening only in IOS7
// Overridden function to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
// iPhone: support only upright portrait
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
else
{
// iPad: any orientation is OK
return YES;
}
}
// For iOS6.0 Rotate
- (BOOL)shouldAutorotate
{
return NO;
}
Use this method to keep it in Portrait view :
[UIApplication sharedApplication].statusBarOrientation = UIInterfaceOrientationPortrait;

Navigation Controller in landscape with Storyboard [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.

iPad application having landscape mode only, issue

if (interfaceOrientation == UIInterfaceOrientationPortrait) {
return NO;
} else if (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
return NO;
} else if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
NSLog(#"Landscape left detected!");
return NO;
} else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
NSLog(#"Landscape right detected!");
return YES;
}
I am trying to implement an iPad app having landscape mode only. I set the Supported interface orientations as Landscape right mode in info.plist. WHen the application is started, the view is in Landscape mode itself. But when i added another view, such as Home view, after login, view is not rotated as landscape. It was in portrait mode. In the xib file also, i set it as landscape. I have included the above code in both Login and Home view controller.
But the home view is not rotating after login.
First you dont have to write checks for each and every orientation. You can achieve this by simply using the following code in your viewController's shouldAutorotateToInterfaceOrientation method
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
Second can you provide more details on how actually you are adding more views. It will be more helpful to find the problem.
do this in each view controller
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
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);
}

Allow only LeftLandscape and RightLandscape orientation

How can I made my app to allow only the landscape orientation but both (left and right)?
so if I rotate 180° the app will be rotate but if I rotate in portrait the app doesn't rotate?
thanks
Try adding this to your UIViewController:
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
You can learn more about this here: UIViewController class reference