문제

Hello All
I did search for this, but didn't get anything useful.
I need to get "Done" button click action of UIDocumentInteractionController. Can anyone please guide me? I am making an app for iPhone & iPad both.

Update:- I also need to hide "Share" button at top right corner.

Thanks in advance.

도움이 되었습니까?

해결책

You can determine whether a user has selected "Done" via the UIDocumentInteractionController's delegate. Simply:

@interface MyClass : NSObject <UIDocumentInteractionControllerDelegate>
...
@end

...

UIDocumentInteractionController* controller = ...;
controller.delegate = self;

...

- (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController *)controller
{
    NSLog(@"User has dismissed preview");
}

As for removing "Share", this isn't easy, and Apple suggest you should have it in all cases. This makes sense, if you're previewing a PDF, the user may very well wish to view it in a dedicated PDF reader, or to email it. If you don't want the ability to share due to business/security reasons, then you'll need to try and render the document yourself. How this is done depends on the document,

다른 팁

For Swift 3.2

You can add this delegate method for performing operations on the click of done button in UIDocumentInteractionController.

func documentInteractionControllerDidEndPreview(_ controller: UIDocumentInteractionController) {
    print("Done Button called here")
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top