簡體   English   中英

如何讓UINavigationController在推送UIViewController時使用翻轉動畫

[英]How to have UINavigationController use flip animation while push a UIViewController

現在我有四個UITableViewControllers

  • 一種
  • B1,B2
  • C

我需要以下效果:

  • 選擇A上的項目可以推送到B1
  • 點擊B1上的rightBarButtonItem可以水平翻轉到B2
  • 點擊B2上的rightBarButtonItem可以水平翻轉到B1
  • 選擇B1或B2上的項目可以推送到C.
  • 可以在B1或B2彈出A

所有視圖(A,B1,B2和C)都應該有NavigationBar。

現在我可以在A,B1,B2,C之間導航。我也可以使用以下代碼翻到B2:

//self is B1
- (IBAction)b2ButtonPressed
{
    B2ViewController* B2 = [[B2ViewController alloc] init];
    B2.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;

    [self presentModalViewController:B2 animated:YES];
}

但在B2上,NavigationBar缺失了。

我的iPod touch上有一個應用程序有這樣的功能。 我怎么能自己做?

如果通過模態顯示而不是通過導航控制器的push或pop顯示視圖控制器,則應該為視圖控制器包裝導航控制器以顯示導航欄:

- (IBAction)b2ButtonPressed
{
  B2ViewController* B2 = [[B2ViewController alloc] init];
  UINavigationController *B2Nav = [[UINavigationController alloc] initWithRootViewController:B2];   
  B2Nav.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
  [self presentModalViewController:B2Nav animated:YES];
  [B2 release];
  [B2Nav release];
}

並且不要忘記在B2ViewController中為導航欄設置左側或右側欄按鈕項。

您是否可以使用UIView animations來翻轉B1視圖,當動畫完成時,在父視圖中添加B2視圖?

我想,這會保持導航欄的原樣。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM