iphone pushviewcontroller to landscape
I've simple iphone application. it has 3 views. first view is portrait view that has 3 buttons. second view has a table view which is also a portrait. In first view, on click of a button second view is shown. on click of a cell in second view, thrid view is shown. but third view is a landscape. I'm using "pushViewController" to navigate from each view. When creating views in IB, first two views are portait and 3rd view is a landscape. In 3rd viewcontroller, i'm using following code as well:
- (BOOL)shouldAutorotateToInterfaceOr开发者_如何学JAVAientation:(UIInterfaceOrientation)interfaceOrientation {
//return UIInterfaceOrientationIsLandscape(interfaceOrientation);
return ((interfaceOrientation == UIInterfaceOrientationLandscapeRight) || (interfaceOrientation == UIInterfaceOrientationLandscapeLeft));
}
How can I show first two views in portrait and third view in landscape.
Try to put this in viewDidLoad
[[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationLandscapeLeft animated:YES];
There is a collection of links to related issues in this thread. In particular, check out the answer of pix0r here.
精彩评论