Question

Bonjour à tous j'ai mon écran de démarrage que je veux montrer en mode paysage et tout autre écran en mode potrait. Mon contrôleur de vue racine agit comme un écran de démarrage, je suis en train d'écrire ce code dans la méthode de viewDidLoad

[[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight]; 

Mais ce code ne fonctionne pas et me montre que UIDevice peut ne pas répondre à setorentation s'il vous plaît me guider que Comment pourrais-je changer le orentation pour seulement le premier écran d'accueil et aussi autre écran doit être en mode potrait

Était-ce utile?

La solution

UIDeviceOrientation se réfère à l'orientation physique du dispositif alors que UIInterfaceOrientation se réfère à l'orientation de l'interface utilisateur. Vous ne pouvez pas modifier l'orientation physique de l'appareil, mais vous pouvez changer la façon dont s'affiche la barre d'état via [UIApplication sharedApplication].statusBarOrientation

Autres conseils

Can't you just have a splash screen that is displayed sideways?

The user will interpret that as a "landscape" splash and adjust accordingly, whether or not your application actually thinks it is. Just make sure to return NO in shouldAutorotateToInterfaceOrientation: so it doesn't rotate away when the user turns it.

But a warning: it's probably worthwhile to tweak your splash screen so it is in the portrait orientation, since it may be annoying to suggest to the user that your app likes landscape, and then switch to portrait as soon as it actually starts.

If you really want to, though, you can use setStatusBarOrientation:animated: on the UIApplication to force the orientation.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top