BMMarkerView is responsible for displaying markers within a map view. More...
Public Member Functions | |
(id) | - initWithMarker:reuseIdentifier: |
Returns a BMMarker object. | |
(void) | - prepareForReuse |
Called when the view is removed from the reuse queue. | |
(void) | - setSelected:animated: |
Sets the selection state of the marker view. You should not call this method directly. An BMMapView object calls this method in response to user interactions with the marker. | |
Properties | |
NSString * | reuseIdentifier |
The string that identifies that this marker view is reusable. | |
id< BMMarker > | marker |
The marker object currently associated with the view. | |
UIImage * | image |
The image to be displayed by the marker view. | |
CGPoint | centerOffset |
The offset (in pixels) at which to place the callout bubble. | |
CGPoint | calloutOffset |
The offset (in pixels) at which to place the callout bubble. | |
BOOL | enabled |
A Boolean value indicating whether the marker is enabled. | |
BOOL | selected |
A Boolean value indicating whether the annotation view is currently selected. You should not set the value of this property directly. If the property contains YES, the marker view is displaying a callout bubble. | |
BOOL | canShowCallout |
Indicates whether the marker has a callout. | |
UIView * | calloutAccessoryView1 |
The view to display on the left side of the standard callout bubble. | |
UIView * | calloutAccessoryView2 |
The view to display on the right side of the standard callout bubble. |
BMMarkerView is responsible for displaying markers within a map view.
A BMMarkerView is linked to an object implementing the BMMarker protocol. When a marker is visible on the map, the BMMapView object asks its delegate to provide a corresponding BMMarkerView. The marker views are being recycled when the marker moves off the screen.
The easiest way to define the look of a marker is to provide an image (image property). The BMMarkerView will size itself depending on the image provided. You can also override the 'DrawRect:' method and draw your own content for the marker. You will have to set the bounds of the view to accommodate the custom drawing.
The markers follow the map's movements but will not be scaled when the map is zoomed in or out.
The BMMarkerView can be selected. When a user taps the marker, the selected state will be 'YES' and a callout will appear. The callout view displays additional information such as a title and a subtitle.
For performance reasons, the markerView objects are being recycled when the markers go off the screen. When you initialize a new BMMarkerView, you should always specify a 'reuse identifier' for this view, as it will be used for recycling the marker view objects.
In the BMMapView delegate 'mapView:viewForMarker:' method, you should use the 'dequeueReusableMarkerViewWithIdentifier:' method to get any available recycled view before instantiating a new BMMarkerView object.
You can subclass the BMMarkerView class to provide custom behaviors. For instance, the BMPushpin class is a subclass of BMMarkerView.
- (id) initWithMarker: | (id <BMMarker>) | marker | |
reuseIdentifier: | (NSString *) | reuseIdentifier | |
Returns a BMMarker object.
marker | The marker to use to initialize the view. |
reuseIdentifier | The identifier to reuse the view when being recycled. |
Reimplemented in BMPushpinView.
- (void) prepareForReuse |
Called when the view is removed from the reuse queue.
- (void) setSelected: | (BOOL) | selected | |
animated: | (BOOL) | animated | |
Sets the selection state of the marker view. You should not call this method directly. An BMMapView object calls this method in response to user interactions with the marker.
selected | Indicates whether the view should display itself as selected. |
animated | Indicates if a change in selection state is animated. |
Reimplemented in BMPushpinView.
- (UIView *) calloutAccessoryView1 [read, write, retain] |
The view to display on the left side of the standard callout bubble.
- (UIView *) calloutAccessoryView2 [read, write, retain] |
The view to display on the right side of the standard callout bubble.
- (CGPoint) calloutOffset [read, write, assign] |
The offset (in pixels) at which to place the callout bubble.
- (BOOL) canShowCallout [read, write, assign] |
Indicates whether the marker has a callout.
If YES, a standard callout bubble is shown when the marker is selected. The marker must have a title for the callout to be shown.
- (CGPoint) centerOffset [read, write, assign] |
The offset (in pixels) at which to place the callout bubble.
By default, the center of marker view is placed over the coordinate of the marker.
- (BOOL) enabled [read, write, assign] |
A Boolean value indicating whether the marker is enabled.
The default value of this property is YES. If the value of this property is NO, the marker view ignores touch events and cannot be selected.
- (UIImage *) image [read, write, retain] |
The image to be displayed by the marker view.
- (id< BMMarker >) marker [read, write, retain] |
The marker object currently associated with the view.
- (NSString *) reuseIdentifier [read, assign] |
The string that identifies that this marker view is reusable.
- (BOOL) selected [read, write, assign] |
A Boolean value indicating whether the annotation view is currently selected. You should not set the value of this property directly. If the property contains YES, the marker view is displaying a callout bubble.