I am trying to add QLPreviewController as childViewController. However I got no success on iOS10. I have checked this link.. No success. Here is my code:
let previewController:QLPreviewController = QLPreviewController()
previewController.dataSource = self
previewController.currentPreviewItemIndex = 0
self.addChildViewController(previewController)
self.view.addSubview(previewController.view)
previewController.view.didMoveToSuperview()
This code block works on the iOS9. Any help will be appreciated.
In this case, the view you are has a zero rect. That is why it is not visible. You can solve it in two different ways: - Using auto layout. - Setting to frame and the autoresizing mask:
previewController.view.frame = self.view.frame;
self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;