我想將UIViewController的視圖添加爲子視圖。但self.view有一個UITabBarController。我想要顯示tabbar上方的子視圖。所以該標籤欄隱藏在子視圖後面。 請提出一些想法。如何添加UIViewController作爲子視圖,在tabbar之上可見?
0
A
回答
2
試試這個,如果你想隱藏/顯示的角度的UITabBarController:
爲了躲的TabBar:
- (void)hideTabBar:(UITabBarController *) tabbarcontroller
{
for(UIView *view in tabbarcontroller.view.subviews)
{
if([view isKindOfClass:[UITabBar class]])
{
[view setFrame:CGRectMake(view.frame.origin.x, (isiPhone5?568:480), view.frame.size.width, view.frame.size.height)];
}
else
{
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, isiPhone5?568: 480)];
}
}
}
作秀的TabBar:
- (void)showTabBar:(UITabBarController *) tabbarcontroller
{
for(UIView *view in tabbarcontroller.view.subviews)
{
if([view isKindOfClass:[UITabBar class]])
{
[view setFrame:CGRectMake(view.frame.origin.x, (isiPhone5?519:431), view.frame.size.width, view.frame.size.height)];
}
else
{
[view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, view.frame.size.width, isiPhone5?519:431)];
}
}
}
可能會幫幫我。
1
你在哪裏alloc和初始化TabBar,所以寫這行
objectOfTabbar.hidden=YES;
然後給你的子視圖相同的TabBarController
框架。 這樣你的tabbar就會隱藏起來,並且會顯示視圖。
相關問題
- 1. 如何將UIViewController作爲子視圖添加到UIViewController(RootViewController)?
- 2. 添加UIViewController作爲UIScrollView的子視圖
- 3. 如何在UIScrollView上添加UIViewController視圖
- 4. 如何將子視圖添加到UIViewController?
- 5. 如何將uitabbarcontroller作爲子視圖添加到UIViewController中
- 6. 如何添加UIViewController作爲編程添加子視圖的目標,如IB
- 7. 添加視圖上的UIViewController
- 8. 如何將視圖添加到任何子視圖上方可見的UINavigationController
- 9. 在UITableViewCell的子視圖中添加UIViewController
- 10. 如何在單擊按鈕時將UIView作爲UIViewController的子視圖添加?
- 11. UIScrollView作爲子視圖添加UIViewController?與UIPageControl
- 12. 將UISplitViewController作爲子視圖添加到UIViewController
- 13. 如何在MainView上添加UIView文件作爲子視圖
- 14. 如何在MainView上添加UIView Nib文件作爲子視圖
- 15. 如何在加載新的TabBar視圖時卸載TabBar視圖?
- 16. 如何將uiviewcontroller的視圖作爲內容視圖添加到uitableviewcell?
- 17. 內存管理,爲UIViewController的子類添加子視圖
- 18. 如何將uiview作爲子視圖添加到現有視圖
- 19. 在地圖上添加圖層TabBar
- 20. 如何添加子視圖到UIViewController推UINavigationBar後面
- 21. 子圖層不可見,除非在viewDidAppear之後添加
- 22. 如何爲切換tabbar視圖控制器添加轉換
- 23. 添加CAShapeLayer作爲不可見的子圖層
- 24. 在tabbar控制器之前添加視圖控制器
- 25. 添加視圖作爲應用程序頂層窗口的子視圖時,警報視圖不可見
- 26. 如何將videoPlayer添加爲子視圖?
- 27. 將故事板添加爲UIViewController中的子視圖
- 28. 如何在Android佈局中添加unityplayer作爲子視圖?
- 29. 如何在目標C中添加QLPreviewController作爲子視圖 - iOS8
- 30. IOS Facebook添加FBNativeAdView作爲子視圖
你只是隱藏tabBar!然後根據需要再次顯示。 –