将标签栏移动到屏幕顶部 [英] Move Tab Bar to top of screen

查看:74
本文介绍了将标签栏移动到屏幕顶部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个标签栏控制器,据我们所知,它显示屏幕底部的标签栏。我正在寻找一种方法将它移到顶部。我不认为我可以使用简单的 UITabBar ,因为我需要在它下面嵌套 UINavigationControllers

I have a Tab Bar Controller which, as we know, displays the tab bar at the bottom of the screen. I'm looking for a way to move it to the top. I don't think I can use a simple UITabBar for this as I need to nest UINavigationControllers under it.

有没有办法将 UITabBarController 中的标签栏移动到屏幕顶部?

Is there any way to move the Tab Bar in a UITabBarController to the top of the screen?

推荐答案

在方法viewDidLayoutSubviews中尝试使用此代码 UITabBarController

Try this code in methods "viewDidLayoutSubviews" your UITabBarController

Swift 2.X

  self.tabbar.frame = CGRectMake(0,0,320,50) //example for iPhone 5

Swift 3.X

  self.tabbar.frame = CGRect(0,0,320,50) //example for iPhone 5

Swift 4.X

  self.tabbar.frame = CGRect( x: 0, y: 0, width: 320, height: 50)  //example for iPhone 5

这篇关于将标签栏移动到屏幕顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆