I have MainWindow.xib in the application.
In the Interface Builder, I rotate the main window from portrait to landscape and than put few UIControls on it.
Than I save it.
A开发者_StackOverflowfter that when I run the application although during design time I made everything in landscape mode, it always displays things in portrait mode.
Please help me
In addition to overriding shouldAutorotate to say what orientations you support, you should also set the "initial interface orientation" key in your info.plist file to set your preferred initial orientation.
For more information, search for "Launching in Landscape Mode" in the iPhone Application Programming Guide.
IB just sets up your XIB files. It's your view controller that manages the orientation.
The default UIViewController or UINavigation controller has details on this.
Specifically, you need to overload
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown ? NO : YES);
}
Have a look at the documentation for UIViewController for more info.
精彩评论