Uitableview 如何为更大的选项卡栏全局设置底部插入?
我有一个应用程序需要一个更大的tabbar(高度=75),但是当我改变tabbar的高度时,安全区域的插入不会改变,所以当我限制底部边距时,它不起作用,我的内容被我的tabbar覆盖。此外,Uitableview 如何为更大的选项卡栏全局设置底部插入?,uitableview,uitabbarcontroller,uitabbar,Uitableview,Uitabbarcontroller,Uitabbar,我有一个应用程序需要一个更大的tabbar(高度=75),但是当我改变tabbar的高度时,安全区域的插入不会改变,所以当我限制底部边距时,它不起作用,我的内容被我的tabbar覆盖。此外,UITableViews没有设置正确的插入,因此无法滚动到底部 我通过在我的UITabBarController子类中添加这个覆盖的func来设置选项卡栏的高度: override func viewWillLayoutSubviews() { super.viewWillLayoutSubviews
UITableView
s没有设置正确的插入,因此无法滚动到底部
我通过在我的UITabBarController
子类中添加这个覆盖的func来设置选项卡栏的高度:
override func viewWillLayoutSubviews() {
super.viewWillLayoutSubviews()
var tabbarHeight: CGFloat = 75
if #available(iOS 11.0, *) {
if let window = UIApplication.shared.keyWindow {
tabbarHeight += window.safeAreaInsets.bottom
}
}
var tabFrame = tabBar.frame
tabFrame.size.height = tabbarHeight
tabFrame.origin.y = view.frame.size.height - tabbarHeight;
tabBar.frame = tabFrame;
}
这样做对吗?有更好的方法吗