PTAnnotationAppearanceViewModel
@interface PTAnnotationAppearanceViewModel<
AnnotationType : PTAnnot *, PropertiesType : PTPDFAnnotationProperties *>
: NSObject
A representation of a PDF annotation.
The class is parameterized by the annotation and properties types which must be subclasses of
the PTAnnot and PTPDFAnnotationProperties classes, respectively.
-
Initializes a
PTAnnotationAppearanceViewModelinstance.Declaration
Objective-C
- (nonnull instancetype)init;Swift
init()Return Value
An initialized
PTAnnotationAppearanceViewModelinstance. -
Configures the view model with the specified annotation.
Note
In Swift, this method is imported as a throwing function.
Declaration
Objective-C
- (BOOL)configureWithAnnotation:(nonnull AnnotationType)annotation onPageNumber:(int)pageNumber inDocument:(nullable PTPDFDoc *)document error:(out NSError *_Nullable *_Nullable)outError;Swift
func configure(withAnnotation annotation: AnnotationType, onPageNumber pageNumber: Int32, inDocument document: PTPDFDoc?) throwsParameters
annotationThe PDF annotation.
pageNumberThe number of the PDF page containing the annotation in the document.
documentThe PDF document, or
nil.outErrorOn input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify
nilfor this parameter if you do not want the error information.Return Value
YESif the view model was configured, orNOif an error occurred. -
The PDF annotation represented by this view model.
Note
The default value of this property isnil.Declaration
Objective-C
@property (nonatomic, strong, readonly, nullable) AnnotationType annotation;Swift
var annotation: AnnotationType? { get } -
The number of the PDF page containing the represented annotation, or
0if there is no annotation.Note
The default value of this property is0.Declaration
Objective-C
@property (nonatomic, readonly) int pageNumber;Swift
var pageNumber: Int32 { get }
-
The properties for the represented annotation.
Declaration
Objective-C
@property (nonatomic, strong, readonly) PropertiesType _Nonnull properties;Swift
var properties: PropertiesType { get } -
The state of the represented annotation.
Declaration
Objective-C
@property (nonatomic, strong, readonly) PTPDFAnnotationState *_Nonnull state;Swift
var state: PTPDFAnnotationState { get }
-
The
PTPDFAnnotationPropertiessubclass used for thePTAnnotationAppearanceViewModel.propertiesinstance property.Subclasses of
PTAnnotationAppearanceViewModelshould override this class property to return the appropriate annotation properties class.Note
The default value of this property is the
PTPDFAnnotationPropertiesclass.Declaration
Objective-C
@property (class, nonatomic, strong, readonly) Class _Nonnull propertiesClass;Swift
class var propertiesClass: AnyClass { get } -
The
PTPDFAnnotationStatesubclass used for thePTAnnotationAppearanceViewModel.stateinstance property.Subclasses of
PTAnnotationAppearanceViewModelshould override this class property to return the appropriate annotation state class.Note
The default value of this property is the
PTPDFAnnotationStateclass.Declaration
Objective-C
@property (class, nonatomic, strong, readonly) Class _Nonnull stateClass;Swift
class var stateClass: AnyClass { get } -
Updates the view model from the represented annotation.
Subclasses of
PTAnnotationAppearanceViewModelshould override this method to update any state dependent on the annotation.Note
In Swift, this method is imported as a throwing function.
Declaration
Objective-C
- (BOOL)updateWithError:(out NSError *_Nullable *_Nullable)outError;Swift
func update() throwsParameters
outErrorOn input, a pointer to an error object. If an error occurs, this pointer is set to an actual error object containing the error information. You may specify
nilfor this parameter if you do not want the error information.Return Value
YESif the view model was updated, orNOif an error occurred.
PTAnnotationAppearanceViewModel Class Reference