В этом блоке кода:
NSArray *supportedOrientations = nil;
if( iPhone ) { // bool
supportedOrientations = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"UISupportedInterfaceOrientations"];
// one array element
}
else if( iPad ) { // bool
supportedOrientations = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"UISupportedInterfaceOrientations~ipad"];
// returns nil
}
else {
NSLog(@"%@:%@ device type not identified", kClassName, kMethodName);
}
Если устройством является iPhone, в файле supportOrientations есть массив.
Если это iPad, supportOrientations равно нулю.
Файл всегда находится, поэтому NSLog никогда не отображается (подтверждается пошаговым выполнением отладчика).
При проверке plist с редактированием текста я вижу:
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
Любые идеи о том, почему это происходит?
Работает в симуляторах iOS версии 4.3.