I'm trying to set the initial orientation for my app to be UIInterfaceOrientationLandscapeLeft
I cant get
'Initial interface orientation'[UIInterfaceOrientation]
to override the first item in array of
'Supported interface orientations'[UISupportedInterfaceOrientations]
I noticed an iphone app always starts with 'Portrait (bottom home button)'.and the array is:
'Supported interface orientations'[UISupportedInterfaceOrientations]
Portrait (bottom home button)
Landscape (left home button)
Landscape (right home button)
Which is as expected.
If I turn PORTRAIT HOME BOTTOM button on Summary page OFF THEN BACK ON then the order of the array changes and Portrait (bottom home button) moves to the bottom.
Landscape (left home button)
Landscape (right home button)
Portrait (bottom home button)
and when I run the app it now starts in Landscape (left home button) as this is now top of the list. Which is fine
BUT
when I add
'Initial interface orientation'[UIInterfaceOrientation]
and set it to
Landscape (right home button)
Its ignored and the first item in the array is used instead
Landscape (left home button)
I checked shouldAutorotateToInterfaceOrientation and it only blocks Portrait upside down
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
} else {
return YES;
}
}
I also added debug code
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if(interfaceOrientation == UIInterfaceOrientationPortrait){
NSLog(@"shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationPortrait");
}else if(interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown){
NSLog(@"shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationPortraitUpsideDown");
}else if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft){
NSLog(@"shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeLeft");
}else if(interfaceOrientation == UIInterfaceOrientationLandscapeRight){
NSLog(@"shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight");
}else {
NSLog(@"shouldAutorotateToInterfaceOrientation:UNKNOWN");
}
return YES;
}
and I get
shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight
shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight
shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight
shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight
shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight
shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeLeft
shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeLeft
so you can see it does try an use
'Initial interface orientation'[UIInterfaceOrientation]
and set it to
Landscape (right home button)
but then it switches back to the first item in the array is used instead
Landscape (left home button)
am I doing something wrong? This is a simple SINGLE VIEW Xcode Template project... just add the debug code.