Pergunta

Estou trabalhando no aplicativo. A orientação do aplicativo é o cenário, mas após a orientação da interface do aplicativo, altere a interface e gira. Exibição da tela Splash de maneira correta (paisagem). Estou usando o iOS7, o aplicativo foi código para iOS5, acho que há algum problema de API depreciado, por exemplo, deve

enter image description here

Foi útil?

Solução

Se você deseja que todos os nossos controladores de navegação respeitem o controlador de visualização superior, você pode usar uma categoria para não precisar passar e alterar vários nomes de classes.

 @implementation UINavigationController (Rotation_IOS6)

-(BOOL)shouldAutorotate
{
   return [[self.viewControllers lastObject] shouldAutorotate];
 } 

-(NSUInteger)supportedInterfaceOrientations
{
    return [[self.viewControllers lastObject] supportedInterfaceOrientations];
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return [[self.viewControllers lastObject]     preferredInterfaceOrientationForPresentation];
}

@end

Como alguns dos comentários apontam, essa é uma solução rápida para o problema. Uma solução melhor é a subclasse uinavigationController e coloca esses métodos lá. Uma subclasse também ajuda a apoiar 6 e 7.

Outras dicas

enter image description here

Você precisa definir o Orintatoin no Build Seeting, consulte a imagem.

Isso resolverá seu problema.

Experimente isso:

- (BOOL)shouldAutorotate
{
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight;
}

Editar:

Veja o anexo link, pode ser útil para você.

Acho que a solução que eu faço é. Etapa um substitui meu uinavigationController, criando uma categoria

Etapa dois substituir [self.window addsubview: [navegaçãoController view]]; //VELHO

Com [self.Window SetrootViewController: NavigationController]; //NOVO

Use isso no seu appdelegate.m

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
    NSLog(@"Interface orientations");
    if([[UIDevice currentDevice]userInterfaceIdiom]==UIUserInterfaceIdiomPad ){

        return UIInterfaceOrientationMaskLandScape;
    }
    else{
        return UIInterfaceOrientationMaskPortrait;
    }
}

Isso me ajudou ..

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top