Reputation: 3387
i am getting a strange problem in my iPhone app. I want my app to support ONLY portrait mode, but for some reason I can't do it (device & simulator).
To support only portrait mode I did as follow:
In the TARGET summary section on Xcode, I chose only portrait.
All my ViewControllers implements shouldAutorotateToInterfaceOrientation
But as I said it won't work, and the strange result is that the app support ALL the orientations (portrait, upside down, landscape left, landscape right). Any ideas?
this how I implement shouldAutorotateToInterfaceOrientation
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
NSLog(@"Checking orientation %d", interfaceOrientation);
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
Many thanks in advance.
Upvotes: 1
Views: 2374
Reputation: 1545
Try this Sir,
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}
Hope It helps. Thanks :)
Upvotes: 1
Reputation: 3918
set the key "Supported interface orientations (iPhone)" with which orientation you want in info.plist file of your app.
Here I am using only Landscape you can use Portrait.
Upvotes: 3