我想得到选项卡的默认大小,但我在ViewController中没有任何ViewController,所以我没有使用self.tabBarController?.tabBar.frame.size.height。
我使用的:
我有一个容器视图(它用ViewController创建),它包括一个collectionview。我想给出一个footer高度,因为主ViewController有一个tabBar,所以我必须给出一个和tabBar size一样的高度。
发布于 2019-05-07 09:44:50
您可以从主VC中获取选项卡的大小,并将其保存到某个全局变量中,然后您可以在应用程序中的任何地方使用它。
发布于 2019-05-07 10:09:32
如果tabBarController是根视图控制器,那么:
let rootController = self.view.window?.rootViewController as! UITabBarController // Main ViewController
let height = rootController?.tabBar.frame.size.heighthttps://stackoverflow.com/questions/56019579
复制相似问题