MGLCalloutView

@protocol MGLCalloutView <NSObject>

A protocol for a UIView subclass that displays information about a selected annotation near that annotation.

  • An object conforming to the MGLAnnotation protocol whose details this callout view displays.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic)
        id<MGLAnnotation> _Nonnull representedObject;
  • A view that the user may tap to perform an action. This view is conventionally positioned on the left side of the callout view.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic) UIView *_Nonnull leftAccessoryView;
  • A view that the user may tap to perform an action. This view is conventionally positioned on the right side of the callout view.

    Declaration

    Objective-C

    @property (readwrite, strong, nonatomic) UIView *_Nonnull rightAccessoryView;
  • An object conforming to the MGLCalloutViewDelegate method that receives messages related to the callout view’s interactive subviews.

    Declaration

    Objective-C

    @property (readwrite, nonatomic) id<MGLCalloutViewDelegate> _Nullable delegate;

    Swift

    weak var delegate: MGLCalloutViewDelegate? { get set }
  • Presents a callout view by adding it to view and pointing at the given rect of view’s bounds. Constrains the callout to the bounds of the given view.

    Declaration

    Objective-C

    - (void)presentCalloutFromRect:(CGRect)rect
                            inView:(nonnull UIView *)view
                 constrainedToView:(nonnull UIView *)constrainedView
                          animated:(BOOL)animated;

    Swift

    func presentCallout(from rect: CGRect, inView view: Any!, constrainedToView constrainedView: Any!, animated: Bool)
  • Dismisses the callout view.

    Declaration

    Objective-C

    - (void)dismissCalloutAnimated:(BOOL)animated;

    Swift

    func dismissCallout(animated: Bool)