DocumentAlignmentButton

Swift

@objc(PSPDFDocumentAlignmentButton)
public final class DocumentAlignmentButton : PDFButton

A button that you can add to your user interface to allow users to initiate the document alignment process.

Displaying the Document Alignment Button

The document alignment button can be added to the userInterfaceView of your PDF view controller, or to any other view in your app.

let button = DocumentAlignmentButton()
pdfViewController.userInterfaceView.addSubview(button)
NSLayoutConstraint.activate([...])

Customizing the Document Alignment Button

To customize the title and the image used in the document alignment button, use the standard setTitle(_:for:) and setImage(_:for:) functions of the UIButton class. The document alignment button also provides a convenience init(title:image:) initializer that does this automatically.

The document alignment button uses tintColor as its background color and foregroundColor as the color of the title and the image. By default, the document alignment button chooses a foreground color such that is has the highest possible contrast with the tint color.

Warning

Don’t call setTitleColor(_:for:) or set the backgroundColor or the imageView.tintColor properties directly. Use tintColor and foregroundColor instead.

PSPDF_EXPORT(PSPDFDocumentAlignmentButton)

  • Initialize the document alignment button with the given title and image.

    Declaration

    Swift

    public init(title: String, image: UIImage?)

    Parameters

    title

    The title of the button.

    image

    The image to display next to the title.

  • Initialize the document alignment button with the default title and image.

    Declaration

    Swift

    public convenience init()
  • The preferred color of the title and the image.

    If this property is nil, the foreground color will be chosen such that it has the highest possible contrast with the tintColor.

    Default: nil.

    Declaration

    Swift

    public var foregroundColor: UIColor? { get set }
  • Undocumented

    Declaration

    Swift

    public override func tintColorDidChange()
  • Undocumented

    Declaration

    Swift

    public override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?)
  • Undocumented

    Declaration

    Swift

    public override var isEnabled: Bool { get set }
  • Undocumented

    Declaration

    Swift

    public override var isHighlighted: Bool { get set }
  • Undocumented

    Declaration

    Swift

    public override var isSelected: Bool { get set }