PSPDFScrollView


@interface PSPDFScrollView
    : PSPDFAvoidingScrollView <UIScrollViewDelegate,
                               UIGestureRecognizerDelegate>

Scroll view that manages one or multiple PSPDFPageViews.

Depending on the pageTransition, either every PSPDFPageView is embedded in a PSPDFScrollView, or there is one global PSPDFScrollView for all PSPDFPageViews. This is also the center for all the gesture recognizers. Subclass to customize behavior (e.g. override gestureRecognizerShouldBegin:)

Warning

If you manually zoom/change the contentOffset, you must use the methods with animation extension. (You don’t have to animate, but those are overridden by PSPDFKit to properly inform the PSPDFPageViews to re-render. You can also use the default UIScrollView properties and manually call updateRenderView on each visible PSPDFPageView)

- (void)setZoomScale:(float)scale animated:(BOOL)animated; - (void)zoomToRect:(CGRect)rect animated:(BOOL)animated; - (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated;

  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFScrollView
        : PSPDFAvoidingScrollView <UIScrollViewDelegate,
                                   UIGestureRecognizerDelegate>
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFScrollView
        : PSPDFAvoidingScrollView <UIScrollViewDelegate,
                                   UIGestureRecognizerDelegate>
  • Index of the currently displayed spread.

    The spread index describes the viewport of a pdf. This essentially means that for documents being displayed in single page mode, the spread index equals the page index, however if displayed in double page mode, one spread contains two pages.

    If you are interested in the actual page index displayed by the scroll view, check the page index from the leftPage or rightPage property.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) NSUInteger spreadIndex;

    Swift

    var spreadIndex: UInt { get set }
  • Use spreadIndex instead, the value returned is the same.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) NSUInteger pageIndex;

    Swift

    var pageIndex: UInt { get set }
  • The configuration data source for this scroll view

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        id<PSPDFPresentationContext> _Nullable presentationContext;

    Swift

    weak var presentationContext: PSPDFPresentationContext? { get }
  • Left page. Always set. Not used in PSPDFPageTransitionCurl.

    Declaration

    Objective-C

    @property (readonly, nonatomic) PSPDFPageView *_Nonnull leftPage;

    Swift

    var leftPage: PSPDFPageView { get }
  • Right page, if doublePageMode is enabled. Not used if the pageCurl transition is used.

    Declaration

    Objective-C

    @property (readonly, nonatomic) PSPDFPageView *_Nonnull rightPage;

    Swift

    var rightPage: PSPDFPageView { get }
  • Enables/Disables zooming. Defaults to YES. If set to NO, will lock current zoom level.

    Declaration

    Objective-C

    @property (getter=isZoomingEnabled, assign, readwrite, nonatomic)
        BOOL zoomingEnabled;

    Swift

    var isZoomingEnabled: Bool { get set }
  • Returns all selected annotations of all visible PSPDFPageViews.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic)
        NSArray<__kindof PSPDFAnnotation *> *_Nonnull selectedAnnotations;

    Swift

    var selectedAnnotations: [PSPDFAnnotation] { get }
  • Tap gesture recognizer to sync with your own recognizers. - warning: Don’t change the delegate.

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        UITapGestureRecognizer *_Nonnull singleTapGesture;

    Swift

    var singleTapGesture: UITapGestureRecognizer { get }
  • Double tap gesture recognizer to sync with your own recognizers. - warning: Don’t change the delegate.

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        UITapGestureRecognizer *_Nonnull doubleTapGesture;

    Swift

    var doubleTapGesture: UITapGestureRecognizer { get }
  • Long press gesture recognizer to sync with your own recognizers. - warning: Don’t change the delegate.

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        UILongPressGestureRecognizer *_Nonnull longPressGesture;

    Swift

    var longPressGesture: UILongPressGestureRecognizer { get }
  • Hit-Testing

    PSPDFKit has a UITapGestureRecognizer to detects taps. There are several different actions called, if one succeeds further processing will be stopped.

    First, we check if we hit a PSPDFLinkAnnotationView and invoke the delegates and default action if found.

    Next, we check if there’s text selection and discard if. Then, touches are relayed to all visible PSPDFPageViews and singleTapped: is called. If one page reports that the touch has been processed; the loop is stopped.

    Next, the didTapOnPageView:atPoint: delegate is called if the touch still hasn’t been processed.

    Lastly, if even the delegate returned NO, we look if isScrollOnTapPageEndEnabled and scroll to the next/previous page if the border is near enough; or just toggle the HUD (if that is allowed)

    Do note that the single and double tap gestures do not have dependencies. This has been made to improve single tap performance. If your app requires this, you can manually add this dependency.

    Declaration

    Objective-C

    - (void)singleTapped:(nonnull UITapGestureRecognizer *)recognizer;

    Swift

    func singleTapped(_ recognizer: UITapGestureRecognizer)
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFScrollView
        : PSPDFAvoidingScrollView <UIScrollViewDelegate,
                                   UIGestureRecognizerDelegate>
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFScrollView
        : PSPDFAvoidingScrollView <UIScrollViewDelegate,
                                   UIGestureRecognizerDelegate>
  • Manually trigger a scroll indicator update.

    Declaration

    Objective-C

    - (void)updateScrollViewIndicator;

    Swift

    func updateIndicator()
  • Manually re-center the content.

    Declaration

    Objective-C

    - (void)ensureContentIsCentered;

    Swift

    func ensureContentIsCentered()
  • View that gets zoomed. attach your views here instead of the PSPDFScrollView to get them zoomed.

    Declaration

    Objective-C

    @property (readonly, nonatomic) UIView *_Nonnull compoundView;

    Swift

    var compoundView: UIView { get }
  • If you override any of these, make sure you call super.

    Declaration

    Objective-C

    - (void)scrollViewDidScroll:(nonnull UIScrollView *)scrollView;

    Swift

    func scrollViewDidScroll(_ scrollView: UIScrollView)
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFScrollView
        : PSPDFAvoidingScrollView <UIScrollViewDelegate,
                                   UIGestureRecognizerDelegate>
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFScrollView
        : PSPDFAvoidingScrollView <UIScrollViewDelegate,
                                   UIGestureRecognizerDelegate>
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFScrollView
        : PSPDFAvoidingScrollView <UIScrollViewDelegate,
                                   UIGestureRecognizerDelegate>
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFScrollView
        : PSPDFAvoidingScrollView <UIScrollViewDelegate,
                                   UIGestureRecognizerDelegate>
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFScrollView
        : PSPDFAvoidingScrollView <UIScrollViewDelegate,
                                   UIGestureRecognizerDelegate>
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFScrollView
        : PSPDFAvoidingScrollView <UIScrollViewDelegate,
                                   UIGestureRecognizerDelegate>
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFScrollView
        : PSPDFAvoidingScrollView <UIScrollViewDelegate,
                                   UIGestureRecognizerDelegate>
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFScrollView
        : PSPDFAvoidingScrollView <UIScrollViewDelegate,
                                   UIGestureRecognizerDelegate>
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFScrollView
        : PSPDFAvoidingScrollView <UIScrollViewDelegate,
                                   UIGestureRecognizerDelegate>
  • Undocumented

    Declaration

    Objective-C

    
    @interface PSPDFScrollView
        : PSPDFAvoidingScrollView <UIScrollViewDelegate,
                                   UIGestureRecognizerDelegate>