[英]How to push UIViewController with replaced UINavigationController
[英]How to have UINavigationController use flip animation while push a UIViewController
現在我有四個UITableViewControllers
。
我需要以下效果:
所有視圖(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.