在Xcode6 Beta 4中,当您单击主视图中的详细信息项时,主 - 详细视图的内置模板不再解除弹出窗口。有没有人知道如何在Beta 4中使用Swift做到这一点?
在早期版本的Xcode6中,模板包含了控制弹出窗口的这两种方法,但它们在Beta 4中不适用于我。
func splitViewController(splitController: UISplitViewController, willHideViewController viewController: UIViewController, withBarButtonItem barButtonItem: UIBarButtonItem, forPopoverController popoverController: UIPopoverController) {
barButtonItem.title = "Master" // NSLocalizedString(@"Master", @"Master")
self.navigationItem.setLeftBarButtonItem(barButtonItem, animated: true)
self.navigationItem.setRightBarButtonItem(UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.Action, target: nil, action: nil), animated: true)
self.masterPopoverController = popoverController
}
func splitViewController(splitController: UISplitViewController, willShowViewController viewController: UIViewController, invalidatingBarButtonItem barButtonItem: UIBarButtonItem) {
// Called when the view is shown again in the split view, invalidating the button and popover controller.
self.navigationItem.setLeftBarButtonItem(nil, animated: true)
self.masterPopoverController = nil
}
答案 0 :(得分:-1)
这将从DetailViewController中删除popover:
override func touchesBegan(touches: NSSet!, withEvent event: UIEvent!) {
self.masterPopoverController!.dismissPopoverAnimated(true)
}