PTHalfModalPresentationController


@interface PTHalfModalPresentationController : UIPresentationController

A presentation controller that displays its presented view controller anchored at the bottom of the screen. In its default configuration, the presentation controller allows touches outside the presented view controller to be passed through to the view(s) underneath.

The height of the presented view controller is determined by its UIViewController.preferredContentSize instance property. If the preferred content size is not set then the presented view controller will extend to the top of the screen, respecting the safe area insets.

The presented view controller can be dismissed by dragging downwards over its view. Pan gesture recognizers inside the presented view controller are given priority over the drag-to-dismiss gesture.

  • Initializes a PTHalfModalPresentationController instance.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithPresentedViewController:
                                (nonnull UIViewController *)presentedViewController
                                   presentingViewController:
                                       (nullable UIViewController *)
                                           presentingViewController;

    Swift

    init(presentedViewController: UIViewController, presenting presentingViewController: UIViewController?)

    Parameters

    presentedViewController

    The view controller being presented modally

    presentingViewController

    The view controller whose content represents the starting point of the transition, or nil

    Return Value

    an initialized PTHalfModalPresentationController instance

  • The views underneath the presented view controller for which touches should be allowed.

    The default value of this property is presentingViewController.view.

    Declaration

    Objective-C

    @property (nonatomic, copy, nullable) NSArray<UIView *> *passthroughViews;

    Swift

    var passthroughViews: [UIView]? { get set }
  • Whether the visible portion of the presenters view is dimmed. When enabled, tapping anywhere outside the presented view controller will dismiss this presentation controller.

    The default value of this property is NO.

    Declaration

    Objective-C

    @property (nonatomic) BOOL dimsBackgroundView;

    Swift

    var dimsBackgroundView: Bool { get set }
  • When non-zero, the corners of the presented view controller are rounded with this radius.

    The default value of this property is 10.0.

    Declaration

    Objective-C

    @property (nonatomic) CGFloat cornerRadius;

    Swift

    var cornerRadius: CGFloat { get set }
  • Whether the grabber “pill” at the top of the presented view controller is hidden.

    The default value of this property is NO.

    Declaration

    Objective-C

    @property (nonatomic, assign, unsafe_unretained, readwrite,
              getter=isGrabberHidden) BOOL grabberHidden;

    Swift

    var isGrabberHidden: Bool { get set }