Como uso o Flip Transition para passar de um UIView para um TableViewController com um NavigationController?

StackOverflow https://stackoverflow.com/questions/2346017

Pergunta

Eu tenho duas visões:um possui apenas um botão (view 1) e o outro contém uma tableview com uma barra de pesquisa (screen2).Quando o usuário clica nesse botão na visualização 1, quero que a visualização 1 vire e exiba a tela 2.

A visualização 2 reside dentro do controlador de navegação com uma barra de navegação na parte superior.

Abaixo está o que tenho por enquanto.A animação de transição funciona e muda para a segunda tela, mas a visualização 2 não possui o SearchBar e o título do NavigationBar.Ambos são definidos dentro da vista 2.


[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES];

navigationController = [[UINavigationController alloc] init];

bestbuyProducts = [[BestBuyProductsViewController alloc] initWithNibName:@"BestBuyProductsViewController" bundle:nil];  
[navigationController pushViewController:bestbuyProducts animated:NO];
[navigationController.view setFrame: [self.view bounds]];
[bestbuyProducts release];

[self.view addSubview:navigationController.view];

[UIView commitAnimations];

Obrigado

Foi útil?

Solução

Para iniciar seu UinAVigationController, não é inicializado corretamente. Use o initWithrootViewController: Método como esse:

bestbuyProducts = [[BestBuyProductsViewController alloc] initWithNibName:@"BestBuyProductsViewController" bundle:nil];  

// Initialise the navigation view with the bestbuyProducts view controller
navigationController = [[UINavigationController alloc] initWithRootViewController:bestbuyProducts ];

Em seguida, tente usar a transição de visualização modal para fazer uma animação flip, é mais fácil e mais seguro começar:

[navigationController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentModalViewController:navigationController animated:YES];

[navigationController release];
[bestbuyProducts release];

Outras dicas

OK, aqui está a versão correta


navigationController = [[UINavigationController alloc] initWithRootViewController:bestbuyProducts];
[bestbuyProducts setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentModalViewController:navigationController animated:YES];

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