3

in Xcode, I tried to design a landscape only user interface.

I both set UIViewController and UIView controls to landscape model. but when I placed the controls, like buttons, images on the UIView, when programe running, only the controls which are placed on top-left area response. Seems the programe is still running in portrait mode.

Cœur
  • 37,241
  • 25
  • 195
  • 267
Xcobe
  • 111
  • 2
  • 7
  • so do u want only landscape not in portrait right.. – ajay Apr 25 '11 at 10:11
  • open info.plist-> supportedinterfaceorientation->add only landscape – ajay Apr 25 '11 at 10:12
  • 1
    Please visit this question for your answer: [Landscape mode only for iphone](http://stackoverflow.com/questions/2647786/landscape-mode-only-for-iphone-or-ipad) – Cyprian Apr 25 '11 at 10:27

1 Answers1

4

In project plist setup Initial interface orientation field in Landscape (left home button). Also setup Supported interface orientations field.

And override method -(BOOL) shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation) interfaceOrientation in your ViewController:

- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
    return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight));
}
Alex Nazarov
  • 1,178
  • 8
  • 16