Currently I am testing my current version in iOS10. I am using Xcode 8 beta 6 for testing. Here Quicklook/QLPreviewController delegate methods are not calling. This code set had been worked with XCode 7 and iOS 9.3 versions. I checked this issue in Apple Developer forum. But could not find a answer. Anyone have fixed this issue? (I am using Objective-C)
How to use Quicklook/QLPreviewController in XCode 8 (iOS 10)?
//----------------- SOLUTION for iOS 10 ( previewer as a subview) -------------------
This issue is occurred when you add the the previewer as a subview. Then we are using below code lines mainly in iOS 9.3 and below versions.
[self addChildViewController:previewer];
self.view addSubview:previewer.view];
[previewer didMoveToParentViewController:self];
In iOS 10 issue comes due to the below code line.
[self addChildViewController:previewer];
For iOS 10 we need to check the version and add above code line. Below is the working code set.
QLPreviewController* previewer = [[QLPreviewController alloc] init];
previewer.dataSource = self;
previewer.delegate = self;
// To avoid iOS 10 previewer issue.
if (SYSTEM_VERSION_LESS_THAN(@"10.0")) {
[self addChildViewController:previewer];
}
CGFloat width = self.view.frame.size.width;
CGFloat height = self.view.frame.size.height;
previewer.view.frame = CGRectMake(0, 102, width, height-300);
[self.view addSubview:previewer.view];
[previewer didMoveToParentViewController:self];