3D Touch Peek View Will not slide up for action
Asked Answered
A

4

8

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.

Atonsah answered 17/10, 2015 at 12:37 Comment(0)
D
33

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

Diastasis answered 29/10, 2015 at 19:1 Comment(2)
I had this thought. Pretty sure I tried it with no joy. I will double check it, perhaps I never tested it properly. Thanks.Atonsah
"that you are previewing" I've been stuck on this for so long and you just solved it for me. Thanks.Sturrock
L
7

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;
}
Lamar answered 10/11, 2015 at 5:11 Comment(0)
T
2

previewActionItems should add in the ViewController which you want Preview not in the ViewController registerForPreviewingWithDelegate

Tierratiersten answered 21/4, 2016 at 3:11 Comment(0)
C
2

Now you need to override a property rather than a function.

override var previewActionItems: [UIPreviewActionItem] {
    return previewActions
}
Cockspur answered 26/2, 2017 at 23:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.