簡體   English   中英

iOs中所有uiview控制器中的操作欄

[英]Action bar in all uiviewcontrollers in iOs

在iOs中創建動作欄(僅一次)的最佳方法是什么,它在所有UIViewControllers中保持其位置/大小/內容? 我可以動畫UIViewController在沒有動畫條的情況下被推動嗎?

我正在檢查是否可以使用UIToolBarUINavigationController完成 我是在正確的軌道上嗎?

提前致謝

是的,這是要走的路。 還可以使用導航層次結構自動為您提供導航欄(操作欄)。 在標簽欄上,您必須創建不同的導航層次結構。

我最后做了以下事情:

1-在故事板中創建一個UIViewController,其中包含一個設計為操作欄的UIView,下面是一個容器

2-我將此容器嵌入到另一個UIViewController中,在這種情況下它將成為根視圖控制器

3-prepareForSegue上 ,我保存了在容器中加載的UIViewController實例

4-要在此UIViewController和第二個之間切換:

UIViewController *newController = ...
UIViewController *oldController = ...

[oldController willMoveToParentViewController:nil];
[self addChildViewController:newController]; 

[self transitionFromViewController:oldController 
toViewController:newController 
duration:0.1
options:UIViewAnimationOptionTransitionNone
animations:^(void) {
    oldController.view.frame = CGRectMake(0 - width, 0, width, height);
    newController.view.frame = CGRectMake(0, 0, width, height);
} 
completion:^(BOOL finished){
    [newController didMoveToParentViewController:self];
}

];

暫無
暫無

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

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