Class: MKMapView

Inherits:
UIView show all

Overview

An MKMapView object provides an embeddable map interface, similar to the one provided by the Maps application. You use this class as-is to display map information and to manipulate the map contents from your application. You can center the map on a given coordinate, specify the size of the area you want to display, and annotate the map with custom information.

Instance Attribute Summary (collapse)

Attributes inherited from UIView

#alpha, #autoresizesSubviews, #autoresizingMask, #backgroundColor, #bounds, #center, #clearsContextBeforeDrawing, #clipsToBounds, #contentMode, #contentScaleFactor, #exclusiveTouch, #frame, #gestureRecognizers, #hidden, #layer, #multipleTouchEnabled, #opaque, #restorationIdentifier, #subviews, #superview, #tag, #transform, #userInteractionEnabled, #window

Attributes inherited from UIResponder

#inputAccessoryView, #inputView, #undoManager

Instance Method Summary (collapse)

Methods inherited from UIView

#addConstraint:, #addConstraints:, #addGestureRecognizer:, #addSubview:, #alignmentRectForFrame:, #alignmentRectInsets, animateWithDuration:animations:, animateWithDuration:animations:completion:, animateWithDuration:delay:options:animations:completion:, areAnimationsEnabled, beginAnimations:context:, #bringSubviewToFront:, commitAnimations, #constraints, #constraintsAffectingLayoutForAxis:, #contentCompressionResistancePriorityForAxis:, #contentHuggingPriorityForAxis:, #convertPoint:fromView:, #convertPoint:toView:, #convertRect:fromView:, #convertRect:toView:, #decodeRestorableStateWithCoder:, #didAddSubview:, #didMoveToSuperview, #didMoveToWindow, #drawRect:, #drawRect:forViewPrintFormatter:, #encodeRestorableStateWithCoder:, #endEditing:, #exchangeSubviewAtIndex:withSubviewAtIndex:, #exerciseAmbiguityInLayout, #frameForAlignmentRect:, #gestureRecognizerShouldBegin:, #hasAmbiguousLayout, #hitTest:withEvent:, #initWithFrame:, #insertSubview:aboveSubview:, #insertSubview:atIndex:, #insertSubview:belowSubview:, #intrinsicContentSize, #invalidateIntrinsicContentSize, #isDescendantOfView:, layerClass, #layoutIfNeeded, #layoutSubviews, #needsUpdateConstraints, #pointInside:withEvent:, #removeConstraint:, #removeConstraints:, #removeFromSuperview, #removeGestureRecognizer:, requiresConstraintBasedLayout, #sendSubviewToBack:, setAnimationBeginsFromCurrentState:, setAnimationCurve:, setAnimationDelay:, setAnimationDelegate:, setAnimationDidStopSelector:, setAnimationDuration:, setAnimationRepeatAutoreverses:, setAnimationRepeatCount:, setAnimationStartDate:, setAnimationTransition:forView:cache:, setAnimationWillStartSelector:, setAnimationsEnabled:, #setContentCompressionResistancePriority:forAxis:, #setContentHuggingPriority:forAxis:, #setNeedsDisplay, #setNeedsDisplayInRect:, #setNeedsLayout, #setNeedsUpdateConstraints, #setTranslatesAutoresizingMaskIntoConstraints:, #sizeThatFits:, #sizeToFit, #systemLayoutSizeFittingSize:, transitionFromView:toView:duration:options:completion:, transitionWithView:duration:options:animations:completion:, #translatesAutoresizingMaskIntoConstraints, #updateConstraints, #updateConstraintsIfNeeded, #viewForBaselineLayout, #viewPrintFormatter, #viewWithTag:, #willMoveToSuperview:, #willMoveToWindow:, #willRemoveSubview:

Methods inherited from UIResponder

#becomeFirstResponder, #canBecomeFirstResponder, #canPerformAction:withSender:, #canResignFirstResponder, #isFirstResponder, #motionBegan:withEvent:, #motionCancelled:withEvent:, #motionEnded:withEvent:, #nextResponder, #reloadInputViews, #remoteControlReceivedWithEvent:, #resignFirstResponder, #touchesBegan:withEvent:, #touchesCancelled:withEvent:, #touchesEnded:withEvent:, #touchesMoved:withEvent:

Methods inherited from NSObject

#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version

Constructor Details

This class inherits a constructor from NSObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class NSObject

Instance Attribute Details

- (Array) annotations (readonly)

The complete list of annotations associated with the receiver. (read-only) The objects in this array must adopt the MKAnnotation protocol. If no annotations are associated with the map view, the value of this property is nil.

Returns:

- (CGRect) annotationVisibleRect (readonly)

The visible rectangle where annotation views are currently being displayed. (read-only)

Returns:

- (CLLocationCoordinate2D) centerCoordinate

The map coordinate at the center of the map view. Changing the value in this property centers the map on the new coordinate without changing the current zoom level. It also updates the values in the region property to reflect the new center coordinate and the new span values needed to maintain the current zoom level.Changing the value of this property updates the map view immediately. If you want to animate the change, use the setCenterCoordinate:animated: method instead.

- (Object) delegate

The receiver’s delegate. A map view sends messages to its delegate regarding the loading of map data and changes in the portion of the map being displayed. The delegate also manages the annotation views used to highlight points of interest on the map. The delegate should implement the methods of the MKMapViewDelegate protocol.

Returns:

- (MKMapType) mapType

The type of data displayed by the map view. Changing the value in this property may cause the receiver to begin loading new map content. For example, changing from MKMapTypeStandard to MKMapTypeSatellite might cause it to begin loading the satellite imagery needed for the map. If new data is needed, however, it is loaded asynchronously and appropriate messages are sent to the receiver’s delegate indicating the status of the operation.

Returns:

  • (MKMapType)

- (Array) overlays (readonly)

The overlay objects currently associated with the map view. (read-only) The objects in this array must adopt the MKOverlay protocol. If no overlays are associated with the map view, the value of this property is an empty array. If the regions defined by two overlays intersect one another, the order of the objects in this array determines the z-order of the corresponding overlay views that are displayed in the map. Overlay objects at the beginning of the array are placed behind those that come later in the array. Thus, the view for an overlay at index 0 is displayed behind the view for the overlay at index 1.

Returns:

- (MKCoordinateRegion) region

The area currently displayed by the map view. The region encompasses both the latitude and longitude point on which the map is centered and the span of coordinates to display. The span values provide an implicit zoom value for the map. The larger the displayed area, the lower the amount of zoom. Similarly, the smaller the displayed area, the greater the amount of zoom. Changing only the center coordinate of the region can still cause the span to change implicitly. The span might change because the distances represented by a span change at different latitudes and longitudes and the map view may need to adjust the span to account for the new location. If you want to change the center coordinate without changing the zoom level, use the centerCoordinate instead.Changing the value of this property updates the map view immediately. When setting this property, the map may adjust the new region value so that it fits the visible area of the map precisely. This is normal and is done to ensure that the value in this property always reflects the visible portion of the map. However, it does mean that if you get the value of this property right after setting it, the returned value may not match the value you set. (You can use the regionThatFits: method to determine the region that will actually be set by the map.) If you want to animate the change in region, use the setRegion:animated: method instead.

Returns:

- (Boolean) scrollEnabled

A Boolean value that determines whether the user may scroll around the map. This property controls only user interactions with the map. If you set the value of this property to NO, you may still change the map location programmatically by changing the value in the region property. The default value of this property is YES.

Returns:

  • (Boolean)

- (Array) selectedAnnotations

The annotations that are currently selected. Assigning a new array to this property selects only the first annotation in the array.

Returns:

- (Boolean) showsUserLocation

A Boolean value indicating whether the map may display the user location. This property does not indicate whether the user’s position is actually visible on the map, only whether the map view is allowed to display it. To determine whether the user’s position is visible, use the userLocationVisible property. The default value of this property is NO.Setting this property to YES causes the map view to use the Core Location framework to find the current location. As long as this property is YES, the map view continues to track the user’s location and update it periodically.

Returns:

  • (Boolean)

- (MKUserLocation) userLocation (readonly)

The annotation object representing the user’s current location. (read-only)

Returns:

- (Boolean) userLocationVisible (readonly)

A Boolean value indicating whether the device’s current location is visible in the map view. (read-only) This property uses the horizontal accuracy of the current location to determine whether the user’s location is visible. Thus, this property is YES if the specific coordinate is offscreen but the rectangle surrounding that coordinate (and defined by the horizontal accuracy value) is partially onscreen.If the user’s location cannot be determined, this property contains the value NO.

Returns:

  • (Boolean)

- (MKUserTrackingMode) userTrackingMode

The mode used to track the user location. Possible values are described in “MKUserTrackingMode.”

Returns:

  • (MKUserTrackingMode)

- (MKMapRect) visibleMapRect

The area currently displayed by the map view. This property represents the same basic information as the region property but specified as a map rectangle instead of a region. Changing the value of this property updates the map view immediately. If you want to animate the change, use the setVisibleMapRect:animated: method instead.

Returns:

- (Boolean) zoomEnabled

A Boolean value that determines whether the user may use pinch gestures to zoom in and out of the map. This property controls only user interactions with the map. If you set the value of this property to NO, you may still change the zoom level programmatically by changing the value in the region property. The default value of this property is YES.

Returns:

  • (Boolean)

Instance Method Details

- (Object) addAnnotation(annotation)

Adds the specified annotation to the map view.

Parameters:

  • annotation (Object)

    The annotation object to add to the receiver. This object must conform to the MKAnnotation protocol. The map view retains the specified object.

Returns:

- (Object) addAnnotations(annotations)

Adds an array of annotation objects to the map view.

Parameters:

  • annotations (Array)

    An array of annotation objects. Each object in the array must conform to the MKAnnotation protocol. The map view retains the individual annotation objects.

Returns:

- (Object) addOverlay(overlay)

Adds a single overlay object to the map. The specified overlay is added to the end of the list of overlay objects. Adding an overlay causes the map view to begin monitoring the area represented by that overlay. As soon as the bounding rectangle of the overlay intersects the visible portion of the map, the map view adds a corresponding overlay view to the map. The overlay view is provided by the mapView:viewForOverlay: method of the map view’s delegate object. To remove an overlay from a map, you must remove the overlay object using the removeOverlay: method.

Parameters:

  • overlay (Object)

    The overlay object to add. This object must conform to the MKOverlay protocol.

Returns:

- (Object) addOverlays(overlays)

Adds an array of overlay objects to the map. The specified objects are added to the end of the list of overlay objects. Adding an overlay causes the map view to begin monitoring the area represented by that overlay. As soon as the bounding rectangle of the overlay intersects the visible portion of the map, the map view adds a corresponding overlay view to the map. The overlay view is provided by the mapView:viewForOverlay: method of the map view’s delegate object. To remove an overlay from a map, you must remove the overlay object using the removeOverlay: method.

Parameters:

  • overlays (Array)

    An array of objects, each of which must conform to the MKOverlay protocol.

Returns:

- (NSSet) annotationsInMapRect(mapRect)

Returns the annotation objects located in the specified map rectangle. This method offers a fast way to retrieve the annotation objects in a particular portion of the map. This method is much faster than doing a linear search of the objects in the annotations property yourself.

Parameters:

  • mapRect (MKMapRect)

    The portion of the map that you want to search for annotations.

Returns:

  • (NSSet)

    The set of annotation objects located in mapRect.

- (CGPoint) convertCoordinate(coordinate, toPointToView:view)

Converts a map coordinate to a point in the specified view.

Parameters:

  • coordinate (CLLocationCoordinate2D)

    The map coordinate for which you want to find the corresponding point.

  • view (UIView)

    The view in whose coordinate system you want to locate the specified map coordinate. If this parameter is nil, the returned point is specified in the window’s coordinate system. If view is not nil, it must belong to the same window as the map view.

Returns:

  • (CGPoint)

    The point (in the appropriate view or window coordinate system) corresponding to the specified latitude and longitude value.

- (CLLocationCoordinate2D) convertPoint(point, toCoordinateFromView:view)

Converts a point in the specified view’s coordinate system to a map coordinate.

Parameters:

  • point (CGPoint)

    The point you want to convert.

  • view (UIView)

    The view that serves as the reference coordinate system for the point parameter.

Returns:

- (MKCoordinateRegion) convertRect(rect, toRegionFromView:view)

Converts a rectangle in the specified view’s coordinate system to a map region.

Parameters:

  • rect (CGRect)

    The rectangle you want to convert.

  • view (UIView)

    The view that serves as the reference coordinate system for the rect parameter.

Returns:

- (CGRect) convertRegion(region, toRectToView:view)

Converts a map region to a rectangle in the specified view.

Parameters:

  • region (MKCoordinateRegion)

    The map region for which you want to find the corresponding view rectangle.

  • view (UIView)

    The view in whose coordinate system you want to locate the specified map region. If this parameter is nil, the returned rectangle is specified in the window’s coordinate system. If view is not nil, it must belong to the same window as the map view.

Returns:

  • (CGRect)

    The rectangle corresponding to the specified map region.

- (MKAnnotationView) dequeueReusableAnnotationViewWithIdentifier(identifier)

Returns a reusable annotation view located by its identifier. For performance reasons, you should generally reuse MKAnnotationView objects in your map views. As annotation views move offscreen, the map view moves them to an internally managed reuse queue. As new annotations move onscreen, and your code is prompted to provide a corresponding annotation view, you should always attempt to dequeue an existing view before creating a new one. Dequeueing saves time and memory during performance-critical operations such as scrolling.

Parameters:

  • identifier (String)

    A string identifying the annotation view to be reused. This string is the same one you specify when initializing the annotation view using the initWithAnnotation:reuseIdentifier: method.

Returns:

  • (MKAnnotationView)

    An annotation view with the specified identifier, or nil if no such object exists in the reuse queue.

- (Object) deselectAnnotation(annotation, animated:animated)

Deselects the specified annotation and hides its callout view.

Parameters:

  • annotation (Object)

    The annotation object to deselect.

  • animated (Boolean)

    If YES, the callout view is animated offscreen.

Returns:

- (Object) exchangeOverlayAtIndex(index1, withOverlayAtIndex:index2)

Exchanges the position of two overlay objects. If either overlay object has an associated view, the position of that view is updated as well. Thus, exchanging views also affects the z-order of overlay views as they appear on the map view.

Parameters:

  • index1 (Integer)

    The index of the first object in the overlays array.

  • index2 (Integer)

    The index of the second object in the overlays array.

Returns:

- (Object) insertOverlay(overlay, aboveOverlay:sibling)

Inserts one overlay object on top of another. This method adds the object in overlay to the map view and positions it relative to the specified sibling object in the overlays array. This position causes the view associated with overlay to be displayed on top of the view associated with sibling.

Parameters:

  • overlay (Object)

    The overlay object to insert.

  • sibling (Object)

    An existing object in the overlays array. This object must exist in the array and must not be nil.

Returns:

- (Object) insertOverlay(overlay, atIndex:index)

Inserts an overlay object into the list associated with the map.

Parameters:

  • overlay (Object)

    The overlay object to insert.

  • index (Integer)

    The index at which to insert the overlay object. If this value is greater than the number of objects in the overlays property, this method appends the object to the end of the array.

Returns:

- (Object) insertOverlay(overlay, belowOverlay:sibling)

Inserts one overlay object below another. This method adds the object in overlay to the map view and positions it relative to the specified sibling object in the overlays array. This position causes the view associated with overlay to be displayed behind the view associated with sibling.

Parameters:

  • overlay (Object)

    The overlay object to insert.

  • sibling (Object)

    An existing object in the overlays array. This object must exist in the array and must not be nil.

Returns:

- (MKMapRect) mapRectThatFits(mapRect)

Adjusts the aspect ratio of the specified map rectangle to ensure that it fits in the map view’s frame. You can use this method to normalize map rectangle values before displaying the corresponding area. This method returns a new map rectangle that both contains the specified rectangle and fits neatly inside the map view’s frame.

Parameters:

  • mapRect (MKMapRect)

    The initial map rectangle whose width and height you want to adjust.

Returns:

  • (MKMapRect)

    A map rectangle that is still centered on the same point of the map but whose width and height are adjusted to fit in the map view’s frame.

- (MKMapRect) mapRectThatFits(mapRect, edgePadding:insets)

Adjusts the aspect ratio of the specified map rectangle, incorporating the specified inset values.

Parameters:

  • mapRect (MKMapRect)

    The initial map rectangle whose width and height you want to adjust.

  • insets (UIEdgeInsets)

    The distance (measured in screen points) by which to inset the returned rectangle from the actual boundaries of the map view’s frame.

Returns:

  • (MKMapRect)

    A map rectangle that is still centered on the same point of the map but whose width and height are adjusted to fit in the map view’s frame minus the inset values.

- (MKCoordinateRegion) regionThatFits(region)

Adjusts the aspect ratio of the specified region to ensure that it fits in the map view’s frame. You can use this method to normalize the region values before displaying them in the map. This method returns a new region that both contains the specified region and fits neatly inside the map view’s frame.

Parameters:

Returns:

  • (MKCoordinateRegion)

    A region that is still centered on the same point of the map but whose span values are adjusted to fit in the map view’s frame.

- (Object) removeAnnotation(annotation)

Removes the specified annotation object from the map view. If the annotation is currently associated with an annotation view, and that view has a reuse identifier, this method removes the annotation view and queues it internally for later reuse. You can retrieve queued annotation views (and associate them with new annotations) using the dequeueReusableAnnotationViewWithIdentifier: method. Removing an annotation object disassociates it from the map view entirely, preventing it from being displayed on the map. Thus, you would typically call this method only when you want to hide or delete a given annotation.

Parameters:

  • annotation (Object)

    The annotation object to remove. This object must conform to the MKAnnotation protocol.

Returns:

- (Object) removeAnnotations(annotations)

Removes an array of annotation objects from the map view. If any annotation object in the array has an associated annotation view, and if that view has a reuse identifier, this method removes the annotation view and queues it internally for later reuse. You can retrieve queued annotation views (and associate them with new annotations) using the dequeueReusableAnnotationViewWithIdentifier: method. Removing annotation objects disassociates them from the map view entirely, preventing them from being displayed on the map. Thus, you would typically call this method only when you want to hide or delete the specified annotations.

Parameters:

  • annotations (Array)

    The array of annotations to remove. Objects in the array must conform to the MKAnnotation protocol.

Returns:

- (Object) removeOverlay(overlay)

Removes a single overlay object from the map. Removing an overlay object removes the corresponding overlay view, if one is currently displayed. If the specified object is not currently associated with the map view, this method does nothing.

Parameters:

  • overlay (Object)

    The overlay object to remove.

Returns:

- (Object) removeOverlays(overlays)

Removes one or more overlay objects from the map. Removing an overlay object removes the corresponding overlay view, if one is currently displayed. If one or more of the overlay objects are not currently associated with the map view, this method removes the objects that are associated with the map and ignores the rest.

Parameters:

  • overlays (Array)

    An array of objects, each of which conforms to the MKOverlay protocol.

Returns:

- (Object) selectAnnotation(annotation, animated:animated)

Selects the specified annotation and displays a callout view for it. If the specified annotation is not onscreen, and therefore does not have an associated annotation view, this method has no effect.

Parameters:

  • annotation (Object)

    The annotation object to select.

  • animated (Boolean)

    If YES, the callout view is animated into position.

Returns:

- (Object) setCenterCoordinate(coordinate, animated:animated)

Changes the center coordinate of the map and optionally animates the change. Changing the center coordinate centers the map on the new coordinate without changing the current zoom level. It also updates the values in the region property to reflect the new center coordinate and the new span values needed to maintain the current zoom level.

Parameters:

  • coordinate (CLLocationCoordinate2D)

    The new center coordinate for the map.

  • animated (Boolean)

    Specify YES if you want the map view to scroll to the new location or NO if you want the map to display the new location immediately.

Returns:

- (Object) setRegion(region, animated:animated)

Changes the currently visible region and optionally animates the change. Changing just the center coordinate of the region can still cause the span values to change implicitly. The span values might change because that the distances represented by a span change at different latitudes and longitudes and the map view may need to adjust the span to account for the new location. If you want to change the center coordinate without changing the zoom level, use the setCenterCoordinate:animated: instead.When setting a new region, the map may adjust the value in the region parameter so that it fits the visible area of the map precisely. This adjustment is normal and is done to ensure that the value in the region property always reflects the visible portion of the map. However, it does mean that if you get the value of that property right after calling this method, the returned value may not match the value you set. (You can use the regionThatFits: method to determine the region that will actually be set by the map.)

Parameters:

  • region (MKCoordinateRegion)

    The new region to display in the map view.

  • animated (Boolean)

    Specify YES if you want the map view to animate the transition to the new region or NO if you want the map to center on the specified region immediately.

Returns:

- (Object) setUserTrackingMode(mode, animated:animated)

Sets the mode used to track the user location with optional animation.

Parameters:

  • mode (MKUserTrackingMode)

    The mode used to track the user location. Possible values are described in “MKUserTrackingMode.”

  • animated (Boolean)

    If YES, the change from the current mode to the new mode is animated; otherwise, it is not. This parameter affects only tracking mode changes. Changes to the user location or heading are always animated.

Returns:

- (Object) setVisibleMapRect(mapRect, animated:animate)

Changes the currently visible portion of the map and optionally animates the change.

Parameters:

  • mapRect (MKMapRect)

    The map rectangle to make visible in the map view.

  • animate (Boolean)

    Specify YES if you want the map view to animate the transition to the new map rectangle or NO if you want the map to center on the specified rectangle immediately.

Returns:

- (Object) setVisibleMapRect(mapRect, edgePadding:insets, animated:animate)

Changes the currently visible portion of the map, allowing you to specify additional space around the edges.

Parameters:

  • mapRect (MKMapRect)

    The map rectangle to make visible in the map view.

  • insets (UIEdgeInsets)

    The amount of additional space (measured in screen points) to make visible around the specified rectangle.

  • animate (Boolean)

    Specify YES if you want the map view to animate the transition to the new map rectangle or NO if you want the map to center on the specified rectangle immediately.

Returns:

- (MKAnnotationView) viewForAnnotation(annotation)

Returns the annotation view associated with the specified annotation object, if any.

Parameters:

  • annotation (Object)

    The annotation object whose view you want.

Returns:

  • (MKAnnotationView)

    The annotation view or nil if the view has not yet been created. This method may also return nil if the annotation is not in the visible map region and therefore does not have an associated annotation view.

- (MKOverlayView) viewForOverlay(overlay)

Returns the view associated with the overlay object if any.

Parameters:

  • overlay (Object)

    The overlay object whose view you want.

Returns:

  • (MKOverlayView)

    The view associated with the overlay object or nil if the overlay is not onscreen.