Je souhaite afficher 1 ou 2 UIViewcontrollers en mode paysage tandis que d'autres dans Portrait. Pour cela j'ai implémenté cette fonction dans AppDelegate.iOS9 supportedInterfaceOrientationsForWindow arrête d'être appelé
-(UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return self.orientation;
}
où dans AppDelegate.h, l'orientation est:
@property (nonatomic, assign) UIInterfaceOrientationMask orientation;
Dans UIViewController (s) où je besoin d'orientation du paysage. Je place ce code
-(void)viewWillAppear:(BOOL)animated
{
self.appDelegate.orientation = UIInterfaceOrientationMaskLandscape;
}
et
-(void)viewWillDisappear:(BOOL)animated
{
self.appDelegate.orientation = UIInterfaceOrientationMaskPortrait;
}
Cependant, quand je vais à 'LandscapeViewController' cela fonctionne ok, je retourne, ça marche ok, je vais à nouveau 'LandscapeViewController' its ok, et puis quand je reviens, la méthode supportedInterfaceOrientationsForWindow cesse d'être appelée. Une raison pour cela? ou je fais quelque chose de bizarre?
oui J'utilise TabBar. – Haris