I have a table view. On 3D Touch I preview a pdf in a QLPreviewController
. The peek and the pop work as intended.
For some reason I cannot get the preview controller view to slide up and show my action items. I am returning a valid array of UIPreviewActionItems in (NSArray<id<UIPreviewActionItem>> *)previewActionItems
.
For some reason when peek is displayed, no amount of sliding upward moves the preview and no action items are made visible as I see in other apps.
I was stuck on this for a while too. Make sure your -previewActionItems
method is in the view controller that you are previewing.
Documentation for -previewActionItems
I had the same issue and was returning the -previewActionsItems
from my preview view controller.
I forgot that I was wrapping this in a UINavigationController which is technically the view controller doing the previewing. I dropped this in a subclass to work round it:
- (NSArray<id<UIPreviewActionItem>> *)previewActionItems
{
return self.topViewController.previewActionItems;
}
previewActionItems should add in the ViewController which you want Preview not in the ViewController registerForPreviewingWithDelegate
Now you need to override a property rather than a function.
override var previewActionItems: [UIPreviewActionItem] {
return previewActions
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With