If you have problem with landscape


When we set landscape mode:

1. In plist.info add string

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

 

2. In AppDelegate file

  1. - (void)applicationDidFinishLaunching:(UIApplication *)application
  2. {
  3. // Override point for customization after application launch
  4.  
  5. [window addSubview:[myViewController view]];
  6.  
  7. [window makeKeyAndVisible];
  8. [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight];
  9.  
  10. application.statusBarOrientation = UIInterfaceOrientationLandscapeRight;
  11. }

 

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

  1. application.statusBarOrientation = UIInterfaceOrientationLandscapeRight;

 

3. And in ViewController.m file

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