【发布时间】:2018-09-08 10:58:58
【问题描述】:
我有一个带有 4 个标签的标签栏控制器。每个选项卡都有一个导航控制器。
在某个时刻,一个视图(就像一个播放器)被添加到 TabBarController 就在 tabBar 项目的上方。
如何使所有 4 个导航控制器及其各自的视图提升 40pt?
我尝试了很多东西,但没有成功。
tabBar类:
UIView.animate(withDuration: Constants.TAB_BAR_ANIMATION_DURATION, animations: { [weak self] in
self?.view?.alpha = 1
self?.viewcontainer.frame = CGRect(x:0, y:UIScreen.main.bounds.height - (self?.tabbarHeight)! - Constants.viewHeight, width:UIScreen.main.bounds.width, height:Constants.viewHeight)
self?.view?.frame = CGRect(x:0, y:0, width:UIScreen.main.bounds.width, height:Constants.viewHeight)
}){[weak self] _ in
self?.viewcontainer.layoutSubviews()
self?.childViewControllers.forEach({ (vc) in
vc.navigationController?.view.frame = CGRect(x:0, y:0, width:UIScreen.main.bounds.width, height:UIScreen.main.bounds.height - 40)
vc.navigationController?.view.layoutIfNeeded()
})
}
最后一部分是问题。还尝试更改视图的高度,但没有找到解决方案。
谢谢!
【问题讨论】:
标签: ios swift uiview uitabbarcontroller containers