PSPDFPageCellImageLoading

Objective-C

@protocol PSPDFPageCellImageLoading <NSObject>

Swift

protocol PDFPageCellImageLoading : NSObjectProtocol

This protocol is responsible for loading images and providing it to the PSPDFPageCell whenever requested by it.

  • Called by the cell if it requires a new image from the image loader.

    See

    PSPDFPageCellImageRequestToken

    Declaration

    Objective-C

    - (nonnull id<PSPDFPageCellImageRequestToken>)
        requestImageForPageAtIndex:(PSPDFPageIndex)pageIndex
                     availableSize:(CGSize)size
                 completionHandler:
                     (nonnull void (^)(UIImage *_Nullable,
                                       NSError *_Nullable))completionHandler;

    Swift

    func requestImageForPage(at pageIndex: PageIndex, availableSize size: CGSize, completionHandler: @escaping (UIImage?, Error?) -> Void) -> PDFPageCellImageRequestToken

    Parameters

    pageIndex

    The page that should be rendered.

    size

    The available size in which the new image needs to fit.

    completionHandler

    The completion handler that you call once you have rendered the image, with an optional error if the loading failed. This can be called on any thread.

    Return Value

    A token that identifies this image request. It can be used to get more information or cancel the request.