PSPDFMultiDocumentViewController
Objective-C
@interface PSPDFMultiDocumentViewController
: PSPDFBaseViewController <PSPDFConflictResolutionManagerDelegate>
Swift
class MultiDocumentViewController : PDFBaseViewController, ConflictResolutionManagerDelegate
Allows displaying multiple PSPDFDocuments
.
-
Initialize the controller.
Declaration
Objective-C
- (nonnull instancetype)initWithPDFViewController: (nullable PSPDFViewController *)pdfController;
Swift
init(pdfViewController pdfController: PSPDFViewController?)
Parameters
pdfController
Set a custom
pdfController
to use a subclass. If nil, a default instance will be created. The passed-in controller will be modified internally and should no longer be used on its own. You probably don’t want to pass aPDFViewController
that already has adocument
set since the multi-document view controller won’t include that document in itsdocuments
array. Instead, set thedocuments
array after creating the multi-document view controller. -
Undocumented
Declaration
Objective-C
- (nullable instancetype)initWithCoder:(NSCoder *)decoder NS_DESIGNATED_INITIALIZER;
Swift
init?(coder decoder: NSCoder)
-
Currently visible document.
Declaration
Objective-C
@property (nonatomic, nullable) PSPDFDocument *visibleDocument;
Swift
var visibleDocument: Document? { get set }
-
Documents that are currently loaded.
Declaration
Objective-C
@property (nonatomic, copy) NSArray<PSPDFDocument *> *_Nonnull documents;
Swift
var documents: [Document] { get set }
-
Delegate to capture events.
Declaration
Objective-C
@property (nonatomic, weak) id<PSPDFMultiDocumentViewControllerDelegate> _Nullable delegate;
Swift
@IBOutlet weak var delegate: MultiDocumentViewControllerDelegate? { get set }
-
Set to YES to enable automatic state persisting. Will be saved to NSUserDefaults. Defaults to NO.
Declaration
Objective-C
@property (nonatomic) BOOL enableAutomaticStatePersistence;
Swift
var enableAutomaticStatePersistence: Bool { get set }
-
Persists the state to
NSUserDefaults
.Warning
Will only persist file-based documents, not documents based on NSData or CGDataProviders. -
Restores state from
NSUserDefaults
. Returns YES on success. Will set the visibleDocument that is saved in the state.Warning
Despite being marked as a property, this has the behavior of a method.Declaration
Objective-C
@property (nonatomic, readonly) BOOL restoreState;
Swift
var restoreState: Bool { get }
-
Restores the state and merges with new documents. First document in the array will be visibleDocument.
Declaration
Objective-C
- (BOOL)restoreStateAndMergeWithDocuments: (nonnull NSArray<PSPDFDocument *> *)documents;
Swift
func restoreStateAndMerge(with documents: [Document]) -> Bool
-
Defaults to
PSPDFMultiDocumentsPersistKey
. Change if you use multiple instances ofPSPDFMultiDocumentViewController
.Declaration
Objective-C
@property (nonatomic, copy) NSString *_Nonnull statePersistenceKey;
Swift
var statePersistenceKey: String { get set }
-
The embedded
PDFViewController
. Access to customize the properties.Declaration
Objective-C
@property (nonatomic, readonly) PSPDFViewController *_Nonnull pdfController;
Swift
var pdfController: PSPDFViewController { get }
-
A Boolean value specifying whether thumbnail view mode shows pages from all loaded documents. If
true
, pages are shown from all loaded documents. Iffalse
, only pages from the current visible document are shown. Defaults tofalse
.Declaration
Objective-C
@property (nonatomic) BOOL thumbnailViewIncludesAllDocuments;
Swift
var thumbnailViewIncludesAllDocuments: Bool { get set }
-
A Boolean value specifying whether
title
should be the title of the current visible document, and therefore shown in the navigation bar or in the overlay. When this is set totrue
and there is enough space available in the navigation bar, the title will be displayed there, if not, the title will be displayed in the overlay. Defaults tofalse
, so no title is shown in the navigation bar or in the overlay.Declaration
Objective-C
@property (nonatomic) BOOL showTitle;
Swift
var showTitle: Bool { get set }
-
Override this initializer to allow all use cases (storyboard loading, etc)
Note
ThepdfController
argument might benil
, but the property of the same name will be non-nil after calling the superclass’s implementation.Declaration
Objective-C
- (void)commonInitWithPDFController: (nullable PSPDFViewController *)pdfController;
Swift
func commonInit(withPDFController pdfController: PSPDFViewController?)
-
Returns the title of the loaded document at a specified index. Can be subclassed to customize what title should be set.
Declaration
Objective-C
- (nonnull NSString *)titleForDocumentAtIndex:(NSUInteger)idx;
Swift
func titleForDocument(at idx: UInt) -> String
-
Called when the title of the document at
idx
changes. Override this to update views.Declaration
Objective-C
- (void)titleDidChangeForDocumentAtIndex:(NSUInteger)idx;
Swift
func titleDidChangeForDocument(at idx: UInt)
-
Persists the current view state. This method by default persists in an internal dictionary. Called any time the visible document changes at an optimal time to persist the view state.
Note
Can be overridden to disable automatic view state restoration.Declaration
Objective-C
- (void)persistViewStateForCurrentVisibleDocument;
Swift
func persistViewStateForCurrentVisibleDocument()
-
Restores the current view state from an internal dictionary, if found. Called any time the visible document changes at an optimal time to restore the view state.
Note
Can be overridden to disable automatic view state restoration.Declaration
Objective-C
- (void)restoreViewStateForCurrentVisibleDocument;
Swift
func restoreViewStateForCurrentVisibleDocument()