Annotations
-
The
MGLAnnotation
protocol is used to provide annotation-related information to a map view. To use this protocol, you adopt it in any custom objects that store or represent annotation data. Each object then serves as the source of information about a single map annotation and provides critical information, such as the annotation’s location on the map. Annotation objects do not provide the visual representation of the annotation but typically coordinate (in conjunction with the map view’s delegate) the creation of an appropriate objects to handle the display.An object that adopts this protocol must implement the
See morecoordinate
property. The other methods of this protocol are optional.Declaration
Objective-C
@protocol MGLAnnotation <NSObject>
-
The MGLAnnotationImage class is responsible for presenting point-based annotations visually on a map view. Annotation image objects wrap
See moreUIImage
objects and may be recycled later and put into a reuse queue that is maintained by the map view.Declaration
Objective-C
@interface MGLAnnotationImage : NSObject
-
The vertical alignment of an annotation within a map view.
See moreDeclaration
Objective-C
enum MGLAnnotationVerticalAlignment : NSUInteger {}
-
A protocol for a
See moreUIView
subclass that displays information about a selected annotation near that annotation.Declaration
Objective-C
@protocol MGLCalloutView <NSObject>
-
The MGLCalloutViewDelegate protocol defines a set of optional methods that you can use to receive messages from an object that conforms to the MGLCalloutView protocol. The callout view uses these methods to inform the delegate that the user has interacted with the the callout view.
See moreDeclaration
Objective-C
@protocol MGLCalloutViewDelegate <NSObject>
-
The
See moreMGLMultiPoint
class is an abstract superclass used to define shapes composed of multiple points. You should not create instances of this class directly. Instead, you should create instances of theMGLPolyline
orMGLPolygon
classes. However, you can use the method and properties of this class to access information about the specific points associated with the line or polygon.Declaration
Objective-C
@interface MGLMultiPoint : MGLShape
-
The
See moreMGLPointAnnotation
class defines a concrete annotation object located at a specified point. You can use this class, rather than define your own, in situations where all you want to do is associate a point on the map with a title.Declaration
Objective-C
@interface MGLPointAnnotation : MGLShape
-
The
See moreMGLPolygon
class represents a shape consisting of one or more points that define a closed polygon. The points are connected end-to-end in the order they are provided. The first and last points are connected to each other to create the closed shape.Declaration
Objective-C
@interface MGLPolygon : MGLMultiPoint <MGLOverlay>
-
The
See moreMGLPolyline
class represents a shape consisting of one or more points that define connecting line segments. The points are connected end-to-end in the order they are provided. The first and last points are not connected to each other.Declaration
Objective-C
@interface MGLPolyline : MGLMultiPoint <MGLOverlay>
-
The
MGLOverlay
protocol defines a specific type of annotation that represents both a point and an area on a map. Overlay objects are essentially data objects that contain the geographic data needed to represent the map area. For example, overlays can take the form of common shapes such as rectangles and circles. They can also describe polygons and other complex shapes.You use overlays to layer more sophisticated content on top of a map view. For example, you could use an overlay to show the boundaries of a national park or trace a bus route along city streets. The Mapbox iOS SDK defines several concrete classes that conform to this protocol and define standard shapes.
Because overlays are also annotations, they have similar usage pattern to annotations. When added to a map view using the
See more-addOverlay:
method, that view detects whenever the overlay’s defined region intersects the visible portion of the map. At that point, the map view asks its delegate to provide a special overlay view to draw the visual representation of the overlay. If you add an overlay to a map view as an annotation instead, it is treated as an annotation with a single point.Declaration
Objective-C
@protocol MGLOverlay <MGLAnnotation>
-
The
See moreMGLShape
class is an abstract class that defines the basic properties for all shape-based annotation objects. This class must be subclassed and cannot be used as is. Subclasses are responsible for defining the geometry of the shape and providing an appropriate value for the coordinate property inherited from theMGLAnnotation
protocol.Declaration
Objective-C
@interface MGLShape : NSObject <MGLAnnotation>
-
The MGLUserLocation class defines a specific type of annotation that identifies the user’s current location. You do not create instances of this class directly. Instead, you retrieve an existing MGLUserLocation object from the userLocation property of the map view displayed in your application.
See moreDeclaration
Objective-C
@interface MGLUserLocation : NSObject <MGLAnnotation>