请帮助解决此问题。 我有一个带有两个容器视图的viewcontroller,每个视图都指向一个单独的viewcontroller。
第一个视图控制器应该显示图像,但顶部被导航栏切断。
我已取消选中"在热门边缘下延伸"。
我的两个容器视图的viewcontrollers几乎是空的。
有什么想法吗?
class ViewController: UIViewController {
var teamMember:TeamMember!
override func viewDidLoad() {
super.viewDidLoad()
if let name = teamMember.firstName {
title = name
}
navigationController?.view.setNeedsLayout()
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if (segue.identifier == "PictureViewController") {
var destination = segue.destination as? UINavigationController
var vc = destination?.topViewController as? PictureViewController
vc?.teamMember = teamMember
}
if (segue.identifier == "BioContentViewController") {
var vc = segue.destination as? BioContentViewController
vc?.teamMember = teamMember
}
}
编辑:我也在设置自定义导航栏项目,我不知道是否会导致问题
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if (segue.identifier == "PictureViewController") {
let backItem = UIBarButtonItem()
backItem.title = "Meet The Team"
navigationItem.backBarButtonItem = backItem
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if (segue.identifier == "teamMemberDetailView") {
let backItem = UIBarButtonItem()
backItem.title = "Meet The Team"
navigationItem.backBarButtonItem = backItem
var vc = segue.destination as? TeamMemberDetailViewController
vc?.teamMember = teamArray[selectedTeamMemberIndex]
}
}
答案 0 :(得分:0)
答案 1 :(得分:0)
尝试为视图控制器设置automaticAdjustScrollViewInset为false
。
我认为这个blog将帮助您使用容器视图控制器。