Interface QLPreviewControllerDelegate


  • public interface QLPreviewControllerDelegate
    • Method Detail

      • previewControllerFrameForPreviewItemInSourceView

        default CGRect previewControllerFrameForPreviewItemInSourceView​(QLPreviewController controller,
                                                                        QLPreviewItem item,
                                                                        org.moe.natj.general.ptr.Ptr<UIView> view)
        Invoked when the preview controller is about to be presented full screen or dismissed from full screen, to provide a zoom effect. Return the origin of the zoom. It should be relative to view, or screen based if view is not set. The controller will fade in/out if the rect is CGRectZero.
      • previewControllerShouldOpenURLForPreviewItem

        default boolean previewControllerShouldOpenURLForPreviewItem​(QLPreviewController controller,
                                                                     NSURL url,
                                                                     QLPreviewItem item)
        Invoked by the preview controller before trying to open an URL tapped in the preview. If not implemented, defaults is YES.
        Returns:
        Returns NO to prevent the preview controller from calling -[UIApplication openURL:] on url.
      • previewControllerTransitionImageForPreviewItemContentRect

        default UIImage previewControllerTransitionImageForPreviewItemContentRect​(QLPreviewController controller,
                                                                                  QLPreviewItem item,
                                                                                  CGRect contentRect)
        Invoked when the preview controller is about to be presented full screen or dismissed from full screen, to provide a smooth transition when zooming. Return an image the controller will crossfade with when zooming. You can specify the actual "document" content rect in the image in contentRect.
        Parameters:
        contentRect - The rect within the image that actually represents the content of the document. For example, for icons the actual rect is generally smaller than the icon itself.
      • previewControllerTransitionViewForPreviewItem

        default UIView previewControllerTransitionViewForPreviewItem​(QLPreviewController controller,
                                                                     QLPreviewItem item)
        Invoked when the preview controller is about to be presented full screen or dismissed from full screen, to provide a smooth transition when zooming. Return the view that will crossfade with the preview.
      • previewControllerDidDismiss

        default void previewControllerDidDismiss​(QLPreviewController controller)
        Invoked after the preview controller is closed.
      • previewControllerWillDismiss

        default void previewControllerWillDismiss​(QLPreviewController controller)
        Invoked before the preview controller is closed.
      • previewControllerDidSaveEditedCopyOfPreviewItemAtURL

        default void previewControllerDidSaveEditedCopyOfPreviewItemAtURL​(QLPreviewController controller,
                                                                          QLPreviewItem previewItem,
                                                                          NSURL modifiedContentsURL)
        * @abstract This method will be called with an edited copy of the contents of the preview item at previewItemURL. * @discussion This can be called after the users save changes in the following cases: - If the returned editing mode of the preview item is QLPreviewItemEditingModeCreateCopy. - If the returned editing mode of the preview item is QLPreviewItemEditingModeUpdateContents and its previewItemURL could not be successfully overwritten. In this case, modifiedContentsURL will point to a temporary file on disk containing the edited copy. - If the returned editing mode of the preview item is QLPreviewItemEditingModeUpdateContents and its content type and the content type of the edited version don't match. This means that the file type of modifiedContentsURL may be different from the one of the preview item. Note that this may be called multiple times in a row with the successive edited versions of the preview item (whenever the users save the changes). * @param modifiedContentsURL NSURL of a temporary file on disk containing the edited copy of the preview item.
      • previewControllerDidUpdateContentsOfPreviewItem

        default void previewControllerDidUpdateContentsOfPreviewItem​(QLPreviewController controller,
                                                                     QLPreviewItem previewItem)
        Called after the preview controller has successfully overwritten the contents of the file at previewItemURL for the preview item with the edited version of the users. May be called multiple times in a row when overwriting the preview item with the successive edited versions of the preview item (whenever the users save the changes).
      • previewControllerEditingModeForPreviewItem

        default long previewControllerEditingModeForPreviewItem​(QLPreviewController controller,
                                                                QLPreviewItem previewItem)
        * @abstract Invoked when the preview controller is loading its data. It is called for each preview item passed to the data source of the preview controller. * @discussion The preview controller does not offer the users to edit previews by default, but it is possible to activate this functionality if its delegate either allows it to overwrite the contents of the preview item, or if it takes care of the updated version of the preview item by implementing previewController:didSaveEditedCopyOfPreviewItem:atURL:. If the returned value is QLPreviewItemEditingModeUpdateContents and the previewController:didSaveEditedCopyOfPreviewItem:atURL: delegate method is implemented, the preview controller will overwrite the contents of the preview item if this is possible. If not (because the new version of the preview item is of a different type for instance), it will instead call previewController:didSaveEditedCopyOfPreviewItem:atURL:. * @param previewItem The preview item for which the controller needs to know how its delegate wants edited versions of the preview item to be handled. * @result A value indicating how the preview controller should handle edited versions of the preview item.