UIView

Swift

extension UIView
  • Adds view as subview and sets translatesAutoresizingMaskIntoConstraints to NO (for auto layout)

    Declaration

    Swift

    @objc(pspdf_addManagedSubview:)
    func addManagedSubview(_ subview: UIView)
  • Resets the receiver’s content hugging- and compression resistance priority to slightly below UILayoutPriorityRequired. The priority is applied along both axis.

    Declaration

    Swift

    @objc(pspdf_hugAndTugContent)
    func hugAndTugContent()
  • Convenience for pspdf_constraintMatchingView:constants: with zero constants.

    Declaration

    Swift

    @discardableResult
    @objc(pspdf_activateConstraintsMatchingView:)
    func activateConstraints(matching view: UIView) -> [NSLayoutConstraint]
  • Activate the constraints needed to exactly layout self to the passed in view. Use positive values to inset the receiver in the view to match.

    @note Constants are added to top, bottom, leading and trailing anchors. Constraints are only activated if the passed in value for a constant is a valid float. @return The activated constraints.

    Declaration

    Swift

    @discardableResult
    @objc(pspdf_activateConstraintsMatchingView:top:bottom:leading:trailing:)
    func activateConstraints(matching view: UIView, top: CGFloat = 0, bottom: CGFloat = 0, leading: CGFloat = 0, trailing: CGFloat = 0) -> [NSLayoutConstraint]
  • Convenience for constraintMatchingLayoutGuide:constants: with zero constants.

    Declaration

    Swift

    @discardableResult
    @objc(pspdf_activateConstraintsMatchingLayoutGuide:)
    func activateConstraints(matching layoutGuide: UILayoutGuide) -> [NSLayoutConstraint]
  • Activate the constraints needed to exactly layout self to the passed in layout guide. @see constraintMatchingView:constants:

    Declaration

    Swift

    @discardableResult
    @objc(pspdf_activateConstraintsMatchingLayoutGuide:top:bottom:leading:trailing:)
    func activateConstraints(matching layoutGuide: UILayoutGuide, top: CGFloat, bottom: CGFloat, leading: CGFloat, trailing: CGFloat) -> [NSLayoutConstraint]
  • Performs the block without animation conditionally.

    Declaration

    Swift

    @objc(pspdf_performWithoutAnimation:block:)
    class func perform(withoutAnimation: Bool, block: () -> Void)
  • Performs a brief shake animation on the receiver.

    Declaration

    Swift

    @objc(pspdf_shakeWithOffset:)
    func shake(withOffset offset: CGPoint)

    Parameters

    offset

    The distance the element should move in either direction.

  • Returns YES, when the view is not hidden, has a nonzero alpha / size and is added to any window.

    Declaration

    Swift

    @objc(pspdf_isVisible)
    var isVisible: Bool { get }
  • Use this to change frame/bounds without triggering layoutSubviews on the parent. Not needed for changes that are performed within layoutSubviews.

    Declaration

    Swift

    @objc(pspdf_performWithoutTriggeringSetNeedsLayout:)
    func performWithoutTriggeringSetNeedsLayout(_ block: () -> Void)
  • Returns if the current layout direction is right-to-left

    Declaration

    Swift

    @objc(pspdf_isRightToLeftLayoutDirection)
    var isRightToLeftLayoutDirection: Bool { get }
  • Applies a CGAffineTransformMakeScale(-1, 1) if the view is in a right-to-left layout direction. If not, it applies CGAffineTransformIdentity

    Declaration

    Swift

    @objc(pspdf_mirrorViewIfRightToLeft)
    func mirrorViewIfRightToLeft()