public class MKMapView extends UIView
NoIntrinsicMetric
Constructor and Description |
---|
MKMapView()
Constructs a default MKMapView object located at (0,0) with 0 weight and
0 height.
|
MKMapView(CGRect frame)
Constructs a MKMapView object initialized with the dimensions and
position specified in the frame parameter.
|
Modifier and Type | Method and Description |
---|---|
void |
addAnnotation(MKAnnotation annotation)
Adds the specified annotation to the map.
|
void |
addAnnotations(List<? extends MKAnnotation> annotations)
Adds the list of annotations to the map.
|
void |
addOverlay(MKOverlay overlay)
Adds the specified overlay to the map.
|
void |
addOverlays(List<MKOverlay> overlays)
Adds the list of overlays to the map.
|
List<MKAnnotation> |
annotations()
Returns the list of annotations for this map.
|
Set<MKAnnotation> |
annotationsInMapRect(MKMapRect rect)
Returns the annotations that are located in the specified rectangle of
the map.
|
CGRect |
annotationVisibleRect()
Returns the rectangle that encloses the visible annotations.
|
CLLocationCoordinate2D |
centerCoordinate()
Returns the coordinates of the map's center.
|
CGPoint |
convertCoordinate(CLLocationCoordinate2D coordinate,
UIView view)
Converts the specified coordinates to a point in the specified view.
|
CLLocationCoordinate2D |
convertPoint(CGPoint point,
UIView view)
Converts the specified point of the given view to this map's coordinates.
|
MKCoordinateRegion |
convertRect(CGRect rect,
UIView view)
Converts the specified rectangle of the given view to a map region.
|
CGRect |
convertRegion(MKCoordinateRegion region,
UIView view)
Converts the specified region of this map to a rectangle in the specified
view.
|
MKMapViewDelegate |
delegate()
Returns the corresponding delegate for the map view.
|
MKAnnotationView |
dequeueReusableAnnotationViewWithIdentifier(String id)
Returns the reusable annotation that corresponds to the specified id.
|
void |
deselectAnnotation(MKAnnotation annotation,
boolean animated)
Deselects the specified annotation using animation or not.
|
void |
exchangeOverlayAtIndex(int index1,
int index2)
Exchanges the two overlays specified by their indices.
|
void |
insertOverlay(MKOverlay overlay,
int index)
Relocates the specified overlay to the given index position.
|
void |
insertOverlayAboveOverlay(MKOverlay overlay,
MKOverlay sibling)
Inserts first overlay above the second overlay.
|
void |
insertOverlayBelowOverlay(MKOverlay overlay,
MKOverlay sibling)
Inserts first overlay below the second overlay.
|
boolean |
isScrollEnabled()
Returns a Boolean that shows whether scrolling of the map is enabled.
|
boolean |
isUserLocationVisible()
Returns a Boolean that shows whether user's location is visible on the
map with annotation.
|
boolean |
isZoomEnabled()
Returns a Boolean that shows whether zooming of the map is enabled.
|
MKMapRect |
mapRectThatFits(MKMapRect mapRect)
Adjusts the specified map rectangle so that it fits in the map view.
|
MKMapRect |
mapRectThatFits(MKMapRect mapRect,
UIEdgeInsets insets)
Adjusts the specified map rectangle according to the given insets values.
|
int |
mapType()
Returns the type of the map.
|
List<MKOverlay> |
overlays()
Return a list of overlays.
|
MKCoordinateRegion |
region()
Returns the area that is currently displayed by the map view.
|
MKCoordinateRegion |
regionThatFits(MKCoordinateRegion region)
Adjust the given region so that it fits in the map view.
|
void |
removeAnnotation(MKAnnotation annotation)
Removes the specified annotation from the map.
|
void |
removeAnnotations(List<? extends MKAnnotation> annotations)
Removes the specified list of annotations from the map.
|
void |
removeOverlay(MKOverlay overlay)
Removes the specified overlay from the map.
|
void |
removeOverlays(List<MKOverlay> overlays)
Removes the list of overlays from the map.
|
void |
selectAnnotation(MKAnnotation annotation,
boolean animated)
Selects the specified annotation using animation or not.
|
List<MKAnnotation> |
selectedAnnotations()
Returns a list with all the selected annotations.
|
void |
setCenterCoordinate(CLLocationCoordinate2D centerCoordinate)
Sets the coordinates of the map's center.
|
void |
setCenterCoordinate(CLLocationCoordinate2D centerCoordinate,
boolean animated)
Sets the coordinates of the map's center using animation or not.
|
void |
setDelegate(MKMapViewDelegate delegate)
Sets the delegate for the map view.
|
void |
setMapType(int MKMapType)
Sets the type of the map.
|
void |
setRegion(MKCoordinateRegion region)
Set the area to be displayed by the map view.
|
void |
setRegion(MKCoordinateRegion region,
boolean animated)
Set the area to be displayed by the map view using animation or not.
|
void |
setScrollEnabled(boolean scrollEnabled)
Sets a Boolean that defines whether scrolling of the map is enabled.
|
void |
setSelectedAnnotations(List<? extends MKAnnotation> selectedAnnotations)
Sets a list with the currently selected annotations.
|
void |
setShowsUserLocation(boolean showsUserLocation)
Sets a Boolean that defines whether the location of the user is visible.
|
void |
setVisibleMapRect(MKMapRect visibleMapRect)
Sets the area displayed by the map view.
|
void |
setVisibleMapRect(MKMapRect visibleMapRect,
boolean animated)
Sets the area displayed by the map view using animation or not.
|
void |
setVisibleMapRect(MKMapRect visibleMapRect,
UIEdgeInsets edgePadding,
boolean animated)
Sets the visible area of the map with the specified insets using
animation or not.
|
void |
setZoomEnabled(boolean zoomEnabled)
Sets a Boolean that defines whether zooming of the map is enabled.
|
boolean |
showsUserLocation()
Returns a Boolean that shows whether the location of the user is visible.
|
MKUserLocation |
userLocation()
Returns the user location.
|
MKAnnotationView |
viewForAnnotation(MKAnnotation annotation)
Returns the annotation view of the specified annotation object.
|
MKOverlayView |
viewForOverlay(MKOverlay overlay)
Deprecated.
|
MKMapRect |
visibleMapRect()
Returns the area currently displayed by the map.
|
void |
willMoveToSuperview(UIView newSuperview)
Informs this view that its superview will change to the one specified as
parameter.
|
accessibilityIdentifier, addConstraint, addConstraints, addGestureRecognizer, addLayoutGuide, addSubview, alpha, animateWithDuration, animateWithDuration, animateWithDuration, areAnimationsEnabled, autoresizesSubviews, autoresizingMask, backgroundColor, bottomAnchor, bounds, bringSubviewToFront, center, centerXAnchor, centerYAnchor, clipsToBounds, constraints, contentCompressionResistancePriorityForAxis, contentHuggingPriorityForAxis, contentMode, convertPointFromView, convertPointToView, convertRectFromView, convertRectToView, didAddSubview, didMoveToSuperview, didMoveToWindow, drawRect, frame, gestureRecognizers, heightAnchor, hitTest, insertSubview, insetsLayoutMarginsFromSafeArea, intrinsicContentSize, invalidateIntrinsicContentSize, isHidden, isMultipleTouchEnabled, isOpaque, isUserInteractionEnabled, layer, layoutIfNeeded, layoutMargins, layoutMarginsDidChange, layoutMarginsGuide, layoutSubviews, leadingAnchor, leftAnchor, maskView, needsUpdateConstraints, nextResponder, overrideUserInterfaceStyle, pointInside, preservesSuperviewLayoutMargins, removeConstraint, removeConstraints, removeFromSuperview, removeGestureRecognizer, removeLayoutGuide, requiresConstraintBasedLayout, restorationIdentifier, rightAnchor, safeAreaInsets, safeAreaLayoutGuide, sendSubviewToBack, setAccessibilityIdentifier, setAlpha, setAnimationBeginsFromCurrentState, setAnimationCurve, setAnimationDelay, setAnimationDuration, setAnimationRepeatAutoreverses, setAnimationRepeatCount, setAnimationsEnabled, setAnimationStartDate, setAutoresizesSubviews, setAutoresizingMask, setBackgroundColor, setBounds, setCenter, setClearsContextBeforeDrawing, setClipsToBounds, setContentCompressionResistancePriority, setContentHuggingPriority, setContentMode, setFrame, setGestureRecognizers, setHidden, setInsetsLayoutMarginsFromSafeArea, setLayoutMargins, setMaskView, setMultipleTouchEnabled, setNeedsDisplay, setNeedsLayout, setNeedsUpdateConstraints, setOpaque, setOverrideUserInterfaceStyle, setPreservesSuperviewLayoutMargins, setRestorationIdentifier, setTag, setTintAdjustmentMode, setTintColor, setTransform, setTranslatesAutoresizingMaskIntoConstraints, setUserInteractionEnabled, sizeThatFits, sizeToFit, subviews, superview, tag, tintAdjustmentMode, tintColor, tintColorDidChange, topAnchor, toString, trailingAnchor, transform, transitionWithView, translatesAutoresizingMaskIntoConstraints, updateConstraints, updateConstraintsIfNeeded, userInterfaceLayoutDirection, viewForFirstBaselineLayout, viewForLastBaselineLayout, widthAnchor, willMoveToWindow, willRemoveSubview, window
becomeFirstResponder, isFirstResponder, resignFirstResponder, touchesBegan, touchesCancelled, touchesEnded, touchesMoved
addObserver, observeValueForKeyPath, performSelector, performSelectorOnMainThread, release, removeObserver, removeObserver, retain, setValueForKey, setValueForUndefinedKey, valueForKey, valueForUndefinedKey
public MKMapView()
public MKMapView(CGRect frame)
frame
- CGRect that defines dimension and position of the MKMapView.public int mapType()
MKMapType
public void setMapType(int MKMapType)
MKMapType
- The type of the map.MKMapType
public boolean isScrollEnabled()
public void setScrollEnabled(boolean scrollEnabled)
scrollEnabled
- A Boolean that shows whether scrolling of the map is
enabled.public boolean isZoomEnabled()
public void setZoomEnabled(boolean zoomEnabled)
zoomEnabled
- A Boolean that shows whether zooming of the map is
enabled.public MKMapViewDelegate delegate()
public void setDelegate(MKMapViewDelegate delegate)
delegate
- The delegate of the map view.public MKCoordinateRegion region()
public void setRegion(MKCoordinateRegion region)
region
- The area displayed by the map view.public void setRegion(MKCoordinateRegion region, boolean animated)
region
- The area displayed by the map view.animated
- TRUE the display is animated.public CLLocationCoordinate2D centerCoordinate()
public void setCenterCoordinate(CLLocationCoordinate2D centerCoordinate)
centerCoordinate
- The coordinates of the map's center.public void setCenterCoordinate(CLLocationCoordinate2D centerCoordinate, boolean animated)
centerCoordinate
- The coordinates of the center.animated
- TRUE the change is animated.public MKMapRect visibleMapRect()
public void setVisibleMapRect(MKMapRect visibleMapRect)
visibleMapRect
- The area displayed by the map view.public void setVisibleMapRect(MKMapRect visibleMapRect, boolean animated)
visibleMapRect
- The visible are of the map.animated
- TRUE the change is animated.public void setVisibleMapRect(MKMapRect visibleMapRect, UIEdgeInsets edgePadding, boolean animated)
visibleMapRect
- The visible area of the map.edgePadding
- The insets of the area.animated
- TRUE then the change is animated.public boolean showsUserLocation()
public void setShowsUserLocation(boolean showsUserLocation)
showsUserLocation
- TRUE then user location is visible.public MKUserLocation userLocation()
public boolean isUserLocationVisible()
public CGPoint convertCoordinate(CLLocationCoordinate2D coordinate, UIView view)
coordinate
- The coordinates to be converted.view
- The view into which the conversion will take place.public CLLocationCoordinate2D convertPoint(CGPoint point, UIView view)
point
- The point to be converted.view
- The view into which the conversion will take place.public CGRect convertRegion(MKCoordinateRegion region, UIView view)
region
- The region to be converted.view
- The view into which the conversion will take place.public MKCoordinateRegion convertRect(CGRect rect, UIView view)
rect
- The rectangle to be converted.view
- The view into which the conversion will take place.public MKCoordinateRegion regionThatFits(MKCoordinateRegion region)
region
- The region to be adjusted.public MKMapRect mapRectThatFits(MKMapRect mapRect)
mapRect
- The map rectangle to be adjusted.public MKMapRect mapRectThatFits(MKMapRect mapRect, UIEdgeInsets insets)
mapRect
- The map rectangle to be adjusted.insets
- The insets to be incorporated to the final map rectangle.public List<MKAnnotation> annotations()
public void addAnnotation(MKAnnotation annotation)
annotation
- The annotation to be added.public void addAnnotations(List<? extends MKAnnotation> annotations)
annotations
- The list of annotations to be added to the map.public void removeAnnotation(MKAnnotation annotation)
annotation
- The annotation to be removed.public void removeAnnotations(List<? extends MKAnnotation> annotations)
annotations
- The list of annotations to be removed.public MKAnnotationView viewForAnnotation(MKAnnotation annotation)
annotation
- The annotation object for which the annotation view is
requested.public Set<MKAnnotation> annotationsInMapRect(MKMapRect rect)
rect
- The rectangle of the map for which the enclosed annotations
are requested.public CGRect annotationVisibleRect()
public MKAnnotationView dequeueReusableAnnotationViewWithIdentifier(String id)
id
- The id of the requested annotation.public List<MKAnnotation> selectedAnnotations()
public void setSelectedAnnotations(List<? extends MKAnnotation> selectedAnnotations)
selectedAnnotations
- A list with the currently selected
annotations.public void selectAnnotation(MKAnnotation annotation, boolean animated)
annotation
- The annotation to be selected.animated
- TRUE then the selection is animated.public void deselectAnnotation(MKAnnotation annotation, boolean animated)
annotation
- The annotation to be deselected.animated
- TRUE then the deselection is animated.public void addOverlay(MKOverlay overlay)
overlay
- The overlay to be added to the map.public void addOverlays(List<MKOverlay> overlays)
overlays
- The list of overlays to be added.public void removeOverlay(MKOverlay overlay)
overlay
- The overlay to be removed.public void removeOverlays(List<MKOverlay> overlays)
overlays
- The list of overlays to be removed.public void insertOverlay(MKOverlay overlay, int index)
overlay
- The overlay that is relocated.index
- The new index of the overlay.public void exchangeOverlayAtIndex(int index1, int index2)
index1
- The index of the first overlay.index2
- The index of the second overlay.public void insertOverlayAboveOverlay(MKOverlay overlay, MKOverlay sibling)
overlay
- The overlay to be inserted.sibling
- The overlay above which the new is inserted.public void insertOverlayBelowOverlay(MKOverlay overlay, MKOverlay sibling)
overlay
- The overlay to be inserted.sibling
- The overlay below which the new is inserted.@Deprecated public MKOverlayView viewForOverlay(MKOverlay overlay)
overlay
- The overlay whose view is requested.public void willMoveToSuperview(UIView newSuperview)
UIView
willMoveToSuperview
in class UIView
newSuperview
- The new superview of this view.Copyright © 2020. All rights reserved.