PSPDFDocumentViewControllerDelegate
Objective-C
@protocol PSPDFDocumentViewControllerDelegate <NSObject>
@optional
/// Called when the spread index changes.
///
/// @note This method is called even if the spread index was modified programmatically.
///
/// @param documentViewController The document view controller whose spread index changed.
/// @param oldSpreadIndex The old spread index, before it was changed.
- (void)documentViewController:(PSPDFDocumentViewController *)documentViewController didChangeSpreadIndex:(NSInteger)oldSpreadIndex;
/// Called when the continuous spread index changes.
///
/// @note This method is called constantly when scrolling. If you implement this method,
/// it should be fast. It is called even if the continuous spread index was modified
/// programmatically.
///
/// @param documentViewController The document view controller whose continuous spread index changed.
/// @param oldContinuousSpreadIndex The old continuous spread index, before it was changed.
- (void)documentViewController:(PSPDFDocumentViewController *)documentViewController didChangeContinuousSpreadIndex:(CGFloat)oldContinuousSpreadIndex;
/// Called whenever the zoom scale is updated.
///
/// @note This method will be called rapidly while the user is actively zooming in or out.
/// Make sure you do the minimum amount of work in this method.
///
/// @param documentViewController The document view controller the change occurred in.
/// @param zoomScale The new zoom scale.
/// @param spreadIndex The index of the spread that was zoomed or `NSNotFound` if the
/// zooming view is responsible for multiple spread views.
- (void)documentViewController:(PSPDFDocumentViewController *)documentViewController didUpdateZoomScale:(CGFloat)zoomScale forSpreadAtIndex:(NSInteger)spreadIndex;
/// Called when a spread view enters the bounds of the document view.
///
/// A spread is considered visible if at least one pixel of it is inside the document
/// view's bounds.
///
/// @see `-documentViewController:didEndDisplayingSpreadView:forSpreadAtIndex:`
///
/// @param documentViewController The document view controller the spread view belongs to.
/// @param spreadView The spread view that is entering the visible bounds.
/// @param spreadIndex The spread index the spread view represents.
- (void)documentViewController:(PSPDFDocumentViewController *)documentViewController willBeginDisplayingSpreadView:(PSPDFSpreadView *)spreadView forSpreadAtIndex:(NSInteger)spreadIndex;
/// Called when a spread view leaves the bounds of the document view.
///
/// A spread is considered visible if at least one pixel of it is inside the document
/// view's bounds.
///
/// @see `-documentViewController:willBeginDisplayingSpreadView:forSpreadAtIndex:`
///
/// @param documentViewController The document view controller the spread view belongs to.
/// @param spreadView The spread view that left the visible bounds.
/// @param spreadIndex The spread index the spread view represents.
- (void)documentViewController:(PSPDFDocumentViewController *)documentViewController didEndDisplayingSpreadView:(PSPDFSpreadView *)spreadView forSpreadAtIndex:(NSInteger)spreadIndex;
/// Called when a spread view is configured and added to the view hierarchy.
///
/// @see `-documentViewController:didCleanupSpreadView:forSpreadAtIndex:`
///
/// @param documentViewController The document view controller the spread view belongs to.
/// @param spreadView The spread view that was configured.
/// @param spreadIndex The spread index the spread view represents.
- (void)documentViewController:(PSPDFDocumentViewController *)documentViewController didConfigureSpreadView:(PSPDFSpreadView *)spreadView forSpreadAtIndex:(NSInteger)spreadIndex;
/// Called when a spread view is cleaned up and removed from the view hierarchy.
///
/// @see `-documentViewController:didConfigureSpreadView:forSpreadAtIndex:`
///
/// @param documentViewController The document view controller the spread view belongs to.
/// @param spreadView The spread view that was cleaned up.
/// @param spreadIndex The spread index the spread view represents.
- (void)documentViewController:(PSPDFDocumentViewController *)documentViewController didCleanupSpreadView:(PSPDFSpreadView *)spreadView forSpreadAtIndex:(NSInteger)spreadIndex;
/// Called when the document view controller is configuring the scroll view that is
/// responsible for scrolling the spreads.
///
/// It is safe to assign a delegate to the `UIScrollView` object received in this delegate.
///
/// @note This delegate method might be called multiple times throughout the lifetime
/// of the scroll view.
///
/// @warning Do not capture the existing scroll view delegate to relay calls - this is handled internally.
///
/// @param documentViewController The document view controller the scroll view belongs to.
/// @param scrollView The scroll view being configured.
- (void)documentViewController:(PSPDFDocumentViewController *)documentViewController configureScrollView:(UIScrollView *)scrollView;
/// Called when the document view controller is configuring a scroll view that is responsible
/// for zooming one or multiple spreads.
///
/// It is safe to assign a delegate to the `UIScrollView` object received in this delegate.
///
/// @note This delegate method might be called multiple times throughout the lifetime
/// of the scroll view.
///
/// @note In some layouts the zoom view is equal to the scroll view responsible for
/// scrolling the spreads. Therefore configuring the zoom view can have an impact
/// on the scrolling behavior.
///
/// @warning Do not capture the existing scroll view delegate to relay calls - this is handled internally.
///
/// @param documentViewController The document view controller the zoom view belongs to.
/// @param zoomView The zoom view being configured.
/// @param spreadIndex The index of the spread the zoom view is displaying or `NSNotFound`
/// if the zoom view is responsible for multiple spreads.
- (void)documentViewController:(PSPDFDocumentViewController *)documentViewController configureZoomView:(UIScrollView *)zoomView forSpreadAtIndex:(NSInteger)spreadIndex;
@end
Swift
protocol PDFDocumentViewControllerDelegate : NSObjectProtocol
Undocumented
-
Called when the spread index changes.
Note
This method is called even if the spread index was modified programmatically.
Declaration
Objective-C
- (void)documentViewController: (nonnull PSPDFDocumentViewController *)documentViewController didChangeSpreadIndex:(NSInteger)oldSpreadIndex;
Swift
optional func documentViewController(_ documentViewController: PDFDocumentViewController, didChangeSpreadIndex oldSpreadIndex: Int)
Parameters
documentViewController
The document view controller whose spread index changed.
oldSpreadIndex
The old spread index, before it was changed.
-
Called when the continuous spread index changes.
Note
This method is called constantly when scrolling. If you implement this method, it should be fast. It is called even if the continuous spread index was modified programmatically.
Declaration
Objective-C
- (void)documentViewController: (nonnull PSPDFDocumentViewController *)documentViewController didChangeContinuousSpreadIndex:(CGFloat)oldContinuousSpreadIndex;
Swift
optional func documentViewController(_ documentViewController: PDFDocumentViewController, didChangeContinuousSpreadIndex oldContinuousSpreadIndex: CGFloat)
Parameters
documentViewController
The document view controller whose continuous spread index changed.
oldContinuousSpreadIndex
The old continuous spread index, before it was changed.
-
Called whenever the zoom scale is updated.
Note
This method will be called rapidly while the user is actively zooming in or out. Make sure you do the minimum amount of work in this method.
Declaration
Objective-C
- (void)documentViewController: (nonnull PSPDFDocumentViewController *)documentViewController didUpdateZoomScale:(CGFloat)zoomScale forSpreadAtIndex:(NSInteger)spreadIndex;
Swift
optional func documentViewController(_ documentViewController: PDFDocumentViewController, didUpdateZoomScale zoomScale: CGFloat, forSpreadAt spreadIndex: Int)
Parameters
documentViewController
The document view controller the change occurred in.
zoomScale
The new zoom scale.
spreadIndex
The index of the spread that was zoomed or
NSNotFound
if the zooming view is responsible for multiple spread views. -
Called when a spread view enters the bounds of the document view.
A spread is considered visible if at least one pixel of it is inside the document view’s bounds.
Declaration
Objective-C
- (void)documentViewController: (nonnull PSPDFDocumentViewController *)documentViewController willBeginDisplayingSpreadView:(nonnull PSPDFSpreadView *)spreadView forSpreadAtIndex:(NSInteger)spreadIndex;
Swift
optional func documentViewController(_ documentViewController: PDFDocumentViewController, willBeginDisplaying spreadView: PSPDFSpreadView, forSpreadAt spreadIndex: Int)
Parameters
documentViewController
The document view controller the spread view belongs to.
spreadView
The spread view that is entering the visible bounds.
spreadIndex
The spread index the spread view represents.
-
Called when a spread view leaves the bounds of the document view.
A spread is considered visible if at least one pixel of it is inside the document view’s bounds.
Declaration
Objective-C
- (void)documentViewController: (nonnull PSPDFDocumentViewController *)documentViewController didEndDisplayingSpreadView:(nonnull PSPDFSpreadView *)spreadView forSpreadAtIndex:(NSInteger)spreadIndex;
Swift
optional func documentViewController(_ documentViewController: PDFDocumentViewController, didEndDisplaying spreadView: PSPDFSpreadView, forSpreadAt spreadIndex: Int)
Parameters
documentViewController
The document view controller the spread view belongs to.
spreadView
The spread view that left the visible bounds.
spreadIndex
The spread index the spread view represents.
-
Called when a spread view is configured and added to the view hierarchy.
Declaration
Objective-C
- (void)documentViewController: (nonnull PSPDFDocumentViewController *)documentViewController didConfigureSpreadView:(nonnull PSPDFSpreadView *)spreadView forSpreadAtIndex:(NSInteger)spreadIndex;
Swift
optional func documentViewController(_ documentViewController: PDFDocumentViewController, didConfigureSpreadView spreadView: PSPDFSpreadView, forSpreadAt spreadIndex: Int)
Parameters
documentViewController
The document view controller the spread view belongs to.
spreadView
The spread view that was configured.
spreadIndex
The spread index the spread view represents.
-
Called when a spread view is cleaned up and removed from the view hierarchy.
Declaration
Objective-C
- (void)documentViewController: (nonnull PSPDFDocumentViewController *)documentViewController didCleanupSpreadView:(nonnull PSPDFSpreadView *)spreadView forSpreadAtIndex:(NSInteger)spreadIndex;
Swift
optional func documentViewController(_ documentViewController: PDFDocumentViewController, didCleanupSpreadView spreadView: PSPDFSpreadView, forSpreadAt spreadIndex: Int)
Parameters
documentViewController
The document view controller the spread view belongs to.
spreadView
The spread view that was cleaned up.
spreadIndex
The spread index the spread view represents.
-
Called when the document view controller is configuring the scroll view that is responsible for scrolling the spreads.
It is safe to assign a delegate to the
UIScrollView
object received in this delegate.Note
This delegate method might be called multiple times throughout the lifetime of the scroll view.
Warning
Do not capture the existing scroll view delegate to relay calls - this is handled internally.
Declaration
Objective-C
- (void)documentViewController: (nonnull PSPDFDocumentViewController *)documentViewController configureScrollView:(nonnull UIScrollView *)scrollView;
Swift
optional func documentViewController(_ documentViewController: PDFDocumentViewController, configureScrollView scrollView: UIScrollView)
Parameters
documentViewController
The document view controller the scroll view belongs to.
scrollView
The scroll view being configured.
-
Called when the document view controller is configuring a scroll view that is responsible for zooming one or multiple spreads.
It is safe to assign a delegate to the
UIScrollView
object received in this delegate.Note
This delegate method might be called multiple times throughout the lifetime of the scroll view.
Note
In some layouts the zoom view is equal to the scroll view responsible for scrolling the spreads. Therefore configuring the zoom view can have an impact on the scrolling behavior.
Warning
Do not capture the existing scroll view delegate to relay calls - this is handled internally.
Declaration
Objective-C
- (void)documentViewController: (nonnull PSPDFDocumentViewController *)documentViewController configureZoomView:(nonnull UIScrollView *)zoomView forSpreadAtIndex:(NSInteger)spreadIndex;
Swift
optional func documentViewController(_ documentViewController: PDFDocumentViewController, configureZoom zoomView: UIScrollView, forSpreadAt spreadIndex: Int)
Parameters
documentViewController
The document view controller the zoom view belongs to.
zoomView
The zoom view being configured.
spreadIndex
The index of the spread the zoom view is displaying or
NSNotFound
if the zoom view is responsible for multiple spreads.