讓我開始以您view.addSubview
添加您UITableViewController
到MSMessagesAppViewController
爲了正確地顯示在導航欄的假設。確保您已正確設置所有約束。下面是我的例子,希望這會爲你工作:
// Embed the new controller. Recommended way of presenting VC shown in WWDC (icecream example). Ugly but does the work
addChildViewController(controller)
view.addSubview(controller.view)
let viewRect = view.bounds
controller.view.frame = viewRect
controller.view.translatesAutoresizingMaskIntoConstraints = false
controller.view.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
controller.view.rightAnchor.constraint(equalTo: view.rightAnchor).isActive = true
controller.view.topAnchor.constraint(equalTo: topLayoutGuide.bottomAnchor).isActive = true
if presentationStyle == .compact {
controller.view.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
} else {
controller.view.bottomAnchor.constraint(equalTo: bottomLayoutGuide.topAnchor).isActive = true
}
controller.didMove(toParentViewController: self)
這裏的鏈接到蘋果開發者論壇的帖子裏面解決我的問題:https://forums.developer.apple.com/thread/52049
是的,有。在第二個屏幕截圖中,「項目」導航欄消失。 –