I'm doing my version app for iPhone, iPhone pro version in the app only works on vision "Portrait" version but it will be the iPad Landscape vision, look what I've done so far:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft);
}
else{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
it detects whether iPhone and if it is, will be in Landscape in any position is that the iPad, iPhone pro is the opposite.
I have not succeeded, did not work.
someone already did something similar? Basically what I want is simple, iPhone == Portrait, iPad == Landscape;
I tried to implement in my project but still always with the view in portrait mode on both the iphone and ipad,
I get this error in debug:
The view controller returned NO from -shouldAutorotateToInterfaceOrientation: for all interface orientations. It should support at least one orientation.
Give this a try.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return (interfaceOrientation == UIInterfaceOrientationPortrait);
} else {
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
}
works fine for me!