Nella mia app universale ho bisogno di gestire diversi orientamenti per iphone e ipad. Per ipad ho bisogno di consentire l'orientamento orizzontale e solo per il ritratto di iphone. Sono tornato qui di seguito il codice in un primo momentoProblema di orientamento IOS 6 nell'app universale
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
return UIInterfaceOrientationIsLandscape(interfaceOrientation);
}
sta lavorando bene in IOS 5, ma in IOS 6 metodo autorotate non è affatto licenziato. Dopo che ho cambiato il metodo per,
-(BOOL)shouldAutorotate
{
return NO;
}
-(NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskAll;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
return UIInterfaceOrientationMaskPortrait;
}
anche questo metodi non sono affatto sparati in IOS 6.
La mia impostazione plist è
ho bisogno di gestire sia orientamento [iPhone-portrait, iPad-landscape] per entrambi IOS 5 e IOS 6. Per favore guidami a risolvere questo problema.
vedere Quindi la mia risposta http: // StackOverflow.it/questions/12933089/i-want-to-make-my-appliaction-only-in-landscape-orientation-in-ios-both-ios-5-a – Deepesh
In aggiunta alla risposta accettata, 'preferredInterfaceOrientationForPresentation' chiede un singolo orientamento e stai restituendo una maschera ('UIInterfaceOrientationMaskPortrait') invece di es. 'UIInterfaceOrientationPortrait'. – Jesper