Protocol: QLPreviewControllerDelegate
Overview
Implement the methods of this protocol in the delegate of a QLPreviewController (Quick Look preview controller) object to:Called when a Quick Look preview is about to be presented full screen or dismissed, to provide a zoom effect.Called by the Quick Look preview controller before trying to open a URL.Called when the Quick Look preview controller is about to be presented full screen or dismissed; used to provide a smooth transition when zooming. (required)Called after the preview controller is closed.Called before the preview controller is closed.
Instance Method Summary (collapse)
-
- previewController:frameForPreviewItem:inSourceView:
Called when a Quick Look preview is about to be presented full screen or dismissed, to provide a zoom effect.
-
- previewController:shouldOpenURL:forPreviewItem:
Called by the Quick Look preview controller before trying to open a URL.
-
- previewController:transitionImageForPreviewItem:contentRect:
Called when the Quick Look preview controller is about to be presented full screen or dismissed; used to provide a smooth transition when zooming.
-
- previewControllerDidDismiss:
Called after the preview controller is closed.
-
- previewControllerWillDismiss:
Called before the preview controller is closed.
Instance Method Details
- (CGRect) previewController(controller, frameForPreviewItem:item, inSourceView:view)
Called when a Quick Look preview is about to be presented full screen or dismissed, to provide a zoom effect. Use this delegate method to configure a zoom animation for presenting and dismissing a Quick Look preview. The zoom proceeds between your own representation of the item and full screen.This method is invoked only when your application uses the animation option for presentation or dismissal. Specifically, the following statements result in invocation of this method:If you instead use Boolean NO in these statements, the Quick Look preview controller displays the preview full-screen immediately, with no transition effect.The preview item, and its origin point, can change while a preview is displayed. For example, the user may navigate to a different item using the controller, or may rotate the device. Always return the correct origin point when zooming to full screen, and when zooming back to your representation of the item.
Note: Zoom animation is most effective on large-screen devices. On iPhone and iPod touch, Apple encourages you to instead use a UINavigationController object to push the Quick Look preview controller into view. When using a navigation controller to push a preview, this method is not invoked.
To produce a zoom animation, return a CGRect object that represents the frame for the preview item as it appears in your application. Use coordinates relative to the UIView object that contains the item, and specify that view in the view parameter.Alternatively, you can use screen coordinates for the returned CGRect object. In this case, you must specify nil in the view parameter.To produce a full-screen fade animation rather than a zoom, return a value of CGRectZero, or leave this method unimplemented.
- (Boolean) previewController(controller, shouldOpenURL:url, forPreviewItem:item)
Called by the Quick Look preview controller before trying to open a URL. This method comes into play when the user taps a URL link in a preview. If you return YES, the Quick Look preview controller invokes the openURL: method on the UIApplication object, sending it the value of the url parameter. If you return NO, the openURL: method is not invoked.If you do not implement this method, it defaults to returning YES.
- (UIImage) previewController(controller, transitionImageForPreviewItem:item, contentRect:contentRect)
Called when the Quick Look preview controller is about to be presented full screen or dismissed; used to provide a smooth transition when zooming. (required)
- (Object) previewControllerDidDismiss(controller)
Called after the preview controller is closed.
- (Object) previewControllerWillDismiss(controller)
Called before the preview controller is closed.