The detail view controller supports peek mode. when we display the detailed controller in peek mode, we need to disable the tooltips/tutorial in detail controller. How do we identify if the view controller is shown in peek mode or full screen mode?
When you instantiate your view controller in the UIViewControllerPreviewing
delegate method, you can set a variable that tells it what context it is in.Then respond accordingly inside of your view controller code.
public func previewingContext(previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? {
//...
let sb = UIStoryboard(name: "DocumentViewer", bundle: nil)
guard let detailViewController =
sb.instantiateViewControllerWithIdentifier("DocumentViewerViewController")
as? DocumentViewerViewController else { return nil }
detailViewController.isPeeking = true // <--- Set variable here
// Other stuff here...
detailViewController.preferredContentSize = CGSize(width: 0.0, height: 380.0)
previewingContext.sourceRect = cell.frame
return detailViewController
}
Then, inside of the detail view controller, enable/disable whatever you need.