If you have problem with landscape


When we set landscape mode:

1. In plist.info add string

1
2
     <key>UIInterfaceOrientation</key>
     <string>UIInterfaceOrientationLandscapeRight</string>

 

2. In AppDelegate file

1
2
3
4
5
6
7
8
9
10
11
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
// Override point for customization after application launch

[window addSubview:[myViewController view]];

[window makeKeyAndVisible];
[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];

application.statusBarOrientation = UIInterfaceOrientationLandscapeRight;
}

 

This string for landscape mode of Alert and many other objects!

1
application.statusBarOrientation = UIInterfaceOrientationLandscapeRight;

 

3. And in ViewController.m file

1
2
3
4
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}