summaryrefslogtreecommitdiff
path: root/platform/ios/src
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-01-26 18:52:44 +0100
committerKonstantin Käfer <mail@kkaefer.com>2017-01-27 11:44:16 +0100
commit62ea1f21858c69f6921c775ba7a3de201f0514d8 (patch)
tree7a4da88706e8a5513e1e13e993b2acc212cae3b1 /platform/ios/src
parenta662508ddde4043ece36d8ea9b424368891d892c (diff)
downloadqtlocation-mapboxgl-62ea1f21858c69f6921c775ba7a3de201f0514d8.tar.gz
[core] remove trailing whitespace, add trailing newlines, add space after //
Diffstat (limited to 'platform/ios/src')
-rw-r--r--platform/ios/src/MGLAPIClient.m26
-rw-r--r--platform/ios/src/MGLAnnotationImage.h10
-rw-r--r--platform/ios/src/MGLAnnotationImage.m4
-rw-r--r--platform/ios/src/MGLAnnotationView.h46
-rw-r--r--platform/ios/src/MGLAnnotationView.mm14
-rw-r--r--platform/ios/src/MGLCalloutView.h2
-rw-r--r--platform/ios/src/MGLCompactCalloutView.m2
-rw-r--r--platform/ios/src/MGLFaux3DUserLocationAnnotationView.m28
-rw-r--r--platform/ios/src/MGLLocationManager.m8
-rw-r--r--platform/ios/src/MGLMapView.h298
-rw-r--r--platform/ios/src/MGLMapView.mm64
-rw-r--r--platform/ios/src/MGLMapViewDelegate.h160
-rw-r--r--platform/ios/src/MGLMapboxEvents.m78
-rw-r--r--platform/ios/src/MGLUserLocation.h6
-rw-r--r--platform/ios/src/MGLUserLocation.m2
-rw-r--r--platform/ios/src/MGLUserLocationAnnotationView.h8
-rw-r--r--platform/ios/src/MGLUserLocationAnnotationView.m10
17 files changed, 383 insertions, 383 deletions
diff --git a/platform/ios/src/MGLAPIClient.m b/platform/ios/src/MGLAPIClient.m
index 5e8ee5fe1d..22ee5c55f5 100644
--- a/platform/ios/src/MGLAPIClient.m
+++ b/platform/ios/src/MGLAPIClient.m
@@ -75,22 +75,22 @@ static NSString * const MGLAPIClientHTTPMethodPost = @"POST";
[request setValue:self.userAgent forHTTPHeaderField:MGLAPIClientHeaderFieldUserAgentKey];
[request setValue:MGLAPIClientHeaderFieldContentTypeValue forHTTPHeaderField:MGLAPIClientHeaderFieldContentTypeKey];
[request setHTTPMethod:MGLAPIClientHTTPMethodPost];
-
+
NSData *jsonData = [self serializedDataForEvents:events];
-
+
// Compressing less than 3 events can have a negative impact on the size.
if (events.count > 2) {
NSData *compressedData = [jsonData mgl_compressedData];
[request setValue:@"deflate" forHTTPHeaderField:MGLAPIClientHeaderFieldContentEncodingKey];
[request setHTTPBody:compressedData];
}
-
+
// Set JSON data if events.count were less than 3 or something went wrong with compressing HTTP body data.
if (!request.HTTPBody) {
[request setValue:nil forHTTPHeaderField:MGLAPIClientHeaderFieldContentEncodingKey];
[request setHTTPBody:jsonData];
}
-
+
return [request copy];
}
@@ -143,10 +143,10 @@ static NSString * const MGLAPIClientHTTPMethodPost = @"POST";
- (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^) (NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler {
if([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
-
+
SecTrustRef serverTrust = [[challenge protectionSpace] serverTrust];
SecTrustResultType trustResult;
-
+
// Validate the certificate chain with the device's trust store anyway
// This *might* give use revocation checking
SecTrustEvaluate(serverTrust, &trustResult);
@@ -154,13 +154,13 @@ static NSString * const MGLAPIClientHTTPMethodPost = @"POST";
{
// Look for a pinned certificate in the server's certificate chain
long numKeys = SecTrustGetCertificateCount(serverTrust);
-
+
BOOL found = NO;
// Try GeoTrust Cert First
for (int lc = 0; lc < numKeys; lc++) {
SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, lc);
NSData *remoteCertificateData = CFBridgingRelease(SecCertificateCopyData(certificate));
-
+
// Compare Remote Key With Local Version
if ([remoteCertificateData isEqualToData:_geoTrustCert]) {
// Found the certificate; continue connecting
@@ -169,13 +169,13 @@ static NSString * const MGLAPIClientHTTPMethodPost = @"POST";
break;
}
}
-
+
if (!found) {
// Fallback to Digicert Cert
for (int lc = 0; lc < numKeys; lc++) {
SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, lc);
NSData *remoteCertificateData = CFBridgingRelease(SecCertificateCopyData(certificate));
-
+
// Compare Remote Key With Local Version
if ([remoteCertificateData isEqualToData:_digicertCert]) {
// Found the certificate; continue connecting
@@ -184,13 +184,13 @@ static NSString * const MGLAPIClientHTTPMethodPost = @"POST";
break;
}
}
-
+
if (!found && _usesTestServer) {
// See if this is test server
for (int lc = 0; lc < numKeys; lc++) {
SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, lc);
NSData *remoteCertificateData = CFBridgingRelease(SecCertificateCopyData(certificate));
-
+
// Compare Remote Key With Local Version
if ([remoteCertificateData isEqualToData:_testServerCert]) {
// Found the certificate; continue connecting
@@ -200,7 +200,7 @@ static NSString * const MGLAPIClientHTTPMethodPost = @"POST";
}
}
}
-
+
if (!found) {
// The certificate wasn't found in GeoTrust nor Digicert. Cancel the connection.
completionHandler(NSURLSessionAuthChallengeCancelAuthenticationChallenge, [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]);
diff --git a/platform/ios/src/MGLAnnotationImage.h b/platform/ios/src/MGLAnnotationImage.h
index 95bce21f51..fbeee18624 100644
--- a/platform/ios/src/MGLAnnotationImage.h
+++ b/platform/ios/src/MGLAnnotationImage.h
@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
Initializes and returns a new annotation image object.
-
+
@param image The image to be displayed for the annotation.
@param reuseIdentifier The string that identifies that this annotation image is
reusable.
@@ -30,11 +30,11 @@ NS_ASSUME_NONNULL_BEGIN
/**
The string that identifies that this annotation image is reusable. (read-only)
-
+
You specify the reuse identifier when you create the image object. You use this
type later to retrieve an annotation image object that was created previously
but which is currently unused because its annotation is not on screen.
-
+
If you define distinctly different types of annotations (with distinctly
different annotation images to go with them), you can differentiate between the
annotation types by specifying different reuse identifiers for each one.
@@ -43,8 +43,8 @@ NS_ASSUME_NONNULL_BEGIN
/**
A Boolean value indicating whether the annotation is enabled.
-
- The default value of this property is `YES`. If the value of this property is
+
+ The default value of this property is `YES`. If the value of this property is
`NO`, the annotation image ignores touch events and cannot be selected.
*/
@property (nonatomic, getter=isEnabled) BOOL enabled;
diff --git a/platform/ios/src/MGLAnnotationImage.m b/platform/ios/src/MGLAnnotationImage.m
index 9c9c175ab9..3b89b19bd8 100644
--- a/platform/ios/src/MGLAnnotationImage.m
+++ b/platform/ios/src/MGLAnnotationImage.m
@@ -52,9 +52,9 @@
- (BOOL)isEqual:(id)other {
if (self == other) return YES;
if (![other isKindOfClass:[MGLAnnotationImage class]]) return NO;
-
+
MGLAnnotationImage *otherAnnotationImage = other;
-
+
return ((!_reuseIdentifier && !otherAnnotationImage.reuseIdentifier)
|| [_reuseIdentifier isEqualToString:otherAnnotationImage.reuseIdentifier])
&& _enabled == otherAnnotationImage.enabled
diff --git a/platform/ios/src/MGLAnnotationView.h b/platform/ios/src/MGLAnnotationView.h
index d159976a4c..532483350a 100644
--- a/platform/ios/src/MGLAnnotationView.h
+++ b/platform/ios/src/MGLAnnotationView.h
@@ -12,7 +12,7 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) {
MGLAnnotationViewDragStateNone = 0,
/**
An action occurred that indicated the view should begin dragging.
-
+
The map view automatically moves draggable annotation views to this state
in response to the dragging the view after pressing and holding on it.
*/
@@ -29,7 +29,7 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) {
MGLAnnotationViewDragStateCanceling,
/**
An action occurred that indicated the view was dropped by the user.
-
+
The map view automatically moves annotation views to this state in response
to the user lifting their finger at the end of a drag gesture.
*/
@@ -44,7 +44,7 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) {
delegate to a corresponding annotation view. If an annotation view is created
with a reuse identifier, the map view may recycle the view when it goes
offscreen.
-
+
Annotation views are compatible with UIKit, Core Animation, and other Cocoa
Touch frameworks. On the other hand, if you do not need animation or
interactivity such as dragging, you can use an `MGLAnnotationImage` instead to
@@ -56,14 +56,14 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) {
/**
Initializes and returns a new annotation view object.
-
+
The reuse identifier provides a way for you to improve performance by recycling
annotation views as they enter and leave the map’s viewport. As an annotation
leaves the viewport, the map view moves its associated view to a reuse queue.
When a new annotation becomes visible, you can request a view for that
annotation by passing the appropriate reuse identifier string to the
`-[MGLMapView dequeueReusableAnnotationViewWithIdentifier:]` method.
-
+
@param reuseIdentifier A unique string identifier for this view that allows you
to reuse this view with multiple similar annotations. You can set this
parameter to `nil` if you don’t intend to reuse the view, but it is a good
@@ -75,7 +75,7 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) {
/**
Called when the view is removed from the reuse queue.
-
+
The default implementation of this method does nothing. You can override it in
your custom annotation view implementation to put the view in a known state
before it is returned to your map view delegate.
@@ -84,7 +84,7 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) {
/**
The annotation object currently associated with the view.
-
+
You should not change the value of this property directly. This property
contains a non-`nil` value while the annotation view is visible on the map. If
the view is queued, waiting to be reused, the value is `nil`.
@@ -93,11 +93,11 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) {
/**
The string that identifies that this annotation view is reusable.
-
+
You specify the reuse identifier when you create the view. You use the
identifier later to retrieve an annotation view that was created previously but
which is currently unused because its annotation is not on-screen.
-
+
If you define distinctly different types of annotations (with distinctly
different annotation views to go with them), you can differentiate between the
annotation types by specifying different reuse identifiers for each one.
@@ -108,14 +108,14 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) {
/**
The offset, measured in points, at which to place the center of the view.
-
+
By default, the center point of an annotation view is placed at the geographic
coordinate point of the associated annotation. If you do not want the view to
be centered, you can use this property to reposition the view. The offset’s
`dx` and `dy` values are measured in points. Positive offset values move the
annotation view down and to the right, while negative values move it up and to
the left.
-
+
Set the offset if the annotation view’s visual center point is somewhere other
than the logical center of the view. For example, the view may contain an image
that depicts a downward-pointing pushpin or thumbtack, with the tip positioned
@@ -128,14 +128,14 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) {
A Boolean value that determines whether the annotation view grows and shrinks
as the distance between the viewpoint and the annotation view changes on a
tilted map.
-
+
When the value of this property is `YES` and the map is tilted, the annotation
view appears smaller if it is towards the top of the view (closer to the
horizon) and larger if it is towards the bottom of the view (closer to the
viewpoint). This is also the behavior of `MGLAnnotationImage` objects. When the
value of this property is `NO` or the map’s pitch is zero, the annotation view
remains the same size regardless of its position on-screen.
-
+
The default value of this property is `YES`. Set this property to `NO` if the
view’s legibility is important.
*/
@@ -145,15 +145,15 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) {
/**
A Boolean value indicating whether the annotation view is currently selected.
-
+
You should not set the value of this property directly. If the property is set
to `YES`, the annotation view is displaying a callout.
-
+
By default, this property is set to `NO` and becomes `YES` when the user taps
the view. Selecting another annotation, whether it is associated with an
`MGLAnnotationView` or `MGLAnnotationImage` object, deselects any currently
selected view.
-
+
Setting this property changes the view’s appearance to reflect the new value
immediately. If you want the change to be animated, use the
`-setSelected:animated:` method instead.
@@ -162,12 +162,12 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) {
/**
Sets the selection state of the annotation view with an optional animation.
-
+
You should not call this method directly. A map view calls this method in
response to user interactions with the annotation. Subclasses may override this
method in order to customize the appearance of the view depending on its
selection state.
-
+
@param selected `YES` if the view should display itself as selected; `NO`
if it should display itself as unselected.
@param animated `YES` if the change in selection state is animated; `NO` if the
@@ -177,7 +177,7 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) {
/*
A Boolean value indicating whether the annotation is enabled.
-
+
The default value of this property is `YES`. If the value of this property is
`NO`, the annotation view ignores touch events and cannot be selected.
Subclasses may also customize the appearance of the view depending on its
@@ -189,12 +189,12 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) {
/**
A Boolean value indicating whether the annotation view is draggable.
-
+
If this property is set to `YES`, the user can drag the annotation after
pressing and holding the view, and the associated annotation object must also
implement the `-setCoordinate:` method. The default value of this property is
`NO`.
-
+
Setting this property to `YES` lets the map view know that the annotation is
always draggable. In other words, you cannot conditionalize drag operations by
attempting to stop an operation that has already been initiated; doing so can
@@ -205,7 +205,7 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) {
/**
The current drag state of the annotation view.
-
+
All states are handled automatically when the `draggable` property is set to
`YES`. To perform a custom animation in response to a change to this property,
override the `-setDragState:animated:` method.
@@ -214,7 +214,7 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationViewDragState) {
/**
Sets the current drag state for the annotation view.
-
+
You can override this method to animate a custom annotation view as the user
drags it. As the system detects user actions that would indicate a drag, it
calls this method to update the drag state.
diff --git a/platform/ios/src/MGLAnnotationView.mm b/platform/ios/src/MGLAnnotationView.mm
index d2243bdf23..5b105cde72 100644
--- a/platform/ios/src/MGLAnnotationView.mm
+++ b/platform/ios/src/MGLAnnotationView.mm
@@ -96,7 +96,7 @@
{
center.x += _centerOffset.dx;
center.y += _centerOffset.dy;
-
+
super.center = center;
[self updateScaleTransformForViewingDistance];
}
@@ -122,14 +122,14 @@
// or 75%. The range goes from a maximum of 100% to 0% as the view moves from the top to the bottom
// along the y axis of its superview.
CGFloat maxScaleReduction = 1.0 - self.center.y / superviewHeight;
-
+
// The pitch intensity represents how much the map view is actually pitched compared to
// what is possible. The value will range from 0% (not pitched at all) to 100% (pitched as much
// as the map view will allow). The map view's maximum pitch is defined in `mbgl::util::PITCH_MAX`.
// Since it is possible for the map view to report a pitch less than 0 due to the nature of
// how the gesture information is captured, the value is guarded with MAX.
CGFloat pitchIntensity = MAX(self.mapView.camera.pitch, 0) / MGLDegreesFromRadians(mbgl::util::PITCH_MAX);
-
+
// The pitch adjusted scale is the inverse proportion of the maximum possible scale reduction
// multiplied by the pitch intensity. For example, if the maximum scale reduction is 75% and the
// map view is 50% pitched then the annotation view should be reduced by 37.5% (.75 * .5). The
@@ -154,7 +154,7 @@
[self willChangeValueForKey:@"draggable"];
_draggable = draggable;
[self didChangeValueForKey:@"draggable"];
-
+
if (draggable)
{
[self enableDrag];
@@ -174,7 +174,7 @@
[self addGestureRecognizer:recognizer];
_longPressRecognizer = recognizer;
}
-
+
if (!_panGestureRecognizer)
{
UIPanGestureRecognizer *recognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
@@ -232,7 +232,7 @@
[self willChangeValueForKey:@"dragState"];
_dragState = dragState;
[self didChangeValueForKey:@"dragState"];
-
+
if (dragState == MGLAnnotationViewDragStateStarting)
{
[self.mapView.calloutViewForSelectedAnnotation dismissCalloutAnimated:animated];
@@ -260,7 +260,7 @@
- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer
{
BOOL isDragging = self.dragState == MGLAnnotationViewDragStateDragging;
-
+
if (gestureRecognizer == _panGestureRecognizer && !(isDragging))
{
return NO;
diff --git a/platform/ios/src/MGLCalloutView.h b/platform/ios/src/MGLCalloutView.h
index 4dc9a25be4..0481a39680 100644
--- a/platform/ios/src/MGLCalloutView.h
+++ b/platform/ios/src/MGLCalloutView.h
@@ -79,7 +79,7 @@ NS_ASSUME_NONNULL_BEGIN
Returns a Boolean value indicating whether the entire callout view “highlights”
when tapped. The default value is `YES`, which means the callout view
highlights when tapped.
-
+
The return value of this method is ignored unless the delegate also responds to
the `-calloutViewTapped` method.
*/
diff --git a/platform/ios/src/MGLCompactCalloutView.m b/platform/ios/src/MGLCompactCalloutView.m
index 3d2118ca38..e499b7832f 100644
--- a/platform/ios/src/MGLCompactCalloutView.m
+++ b/platform/ios/src/MGLCompactCalloutView.m
@@ -25,7 +25,7 @@
- (void)setRepresentedObject:(id <MGLAnnotation>)representedObject
{
_representedObject = representedObject;
-
+
if ([representedObject respondsToSelector:@selector(title)])
{
self.title = representedObject.title;
diff --git a/platform/ios/src/MGLFaux3DUserLocationAnnotationView.m b/platform/ios/src/MGLFaux3DUserLocationAnnotationView.m
index d47722819e..6db9c0db10 100644
--- a/platform/ios/src/MGLFaux3DUserLocationAnnotationView.m
+++ b/platform/ios/src/MGLFaux3DUserLocationAnnotationView.m
@@ -224,21 +224,21 @@ const CGFloat MGLUserLocationAnnotationArrowSize = MGLUserLocationAnnotationPuck
[self updateFrameWithSize:MGLUserLocationAnnotationDotSize];
}
-
+
BOOL showHeadingIndicator = self.mapView.userTrackingMode == MGLUserTrackingModeFollowWithHeading;
-
+
// update heading indicator
//
if (showHeadingIndicator)
{
_headingIndicatorLayer.hidden = NO;
-
+
// heading indicator (tinted, semi-circle)
//
if ( ! _headingIndicatorLayer && self.userLocation.heading.headingAccuracy)
{
CGFloat headingIndicatorSize = MGLUserLocationAnnotationHaloSize;
-
+
_headingIndicatorLayer = [CALayer layer];
_headingIndicatorLayer.bounds = CGRectMake(0, 0, headingIndicatorSize, headingIndicatorSize);
_headingIndicatorLayer.position = CGPointMake(super.bounds.size.width / 2.0, super.bounds.size.height / 2.0);
@@ -249,10 +249,10 @@ const CGFloat MGLUserLocationAnnotationArrowSize = MGLUserLocationAnnotationPuck
_headingIndicatorLayer.shouldRasterize = YES;
_headingIndicatorLayer.rasterizationScale = [UIScreen mainScreen].scale;
_headingIndicatorLayer.drawsAsynchronously = YES;
-
+
[self.layer insertSublayer:_headingIndicatorLayer below:_dotBorderLayer];
}
-
+
// heading indicator accuracy mask (fan-shaped)
//
if ( ! _headingIndicatorMaskLayer && self.userLocation.heading.headingAccuracy)
@@ -260,21 +260,21 @@ const CGFloat MGLUserLocationAnnotationArrowSize = MGLUserLocationAnnotationPuck
_headingIndicatorMaskLayer = [CAShapeLayer layer];
_headingIndicatorMaskLayer.frame = _headingIndicatorLayer.bounds;
_headingIndicatorMaskLayer.path = [[self headingIndicatorClippingMask] CGPath];
-
+
// apply the mask to the halo-radius-sized gradient layer
_headingIndicatorLayer.mask = _headingIndicatorMaskLayer;
-
+
_oldHeadingAccuracy = self.userLocation.heading.headingAccuracy;
-
+
}
else if (_oldHeadingAccuracy != self.userLocation.heading.headingAccuracy)
{
// recalculate the clipping mask based on updated accuracy
_headingIndicatorMaskLayer.path = [[self headingIndicatorClippingMask] CGPath];
-
+
_oldHeadingAccuracy = self.userLocation.heading.headingAccuracy;
}
-
+
if (self.userLocation.heading.trueHeading >= 0)
{
_headingIndicatorLayer.affineTransform = CGAffineTransformRotate(CGAffineTransformIdentity, -MGLRadiansFromDegrees(self.mapView.direction - self.userLocation.heading.trueHeading));
@@ -294,7 +294,7 @@ const CGFloat MGLUserLocationAnnotationArrowSize = MGLUserLocationAnnotationPuck
if (_accuracyRingLayer && (_oldZoom != self.mapView.zoomLevel || _oldHorizontalAccuracy != self.userLocation.location.horizontalAccuracy))
{
CGFloat accuracyRingSize = [self calculateAccuracyRingSize];
-
+
// only show the accuracy ring if it won't be obscured by the location dot
if (accuracyRingSize > MGLUserLocationAnnotationDotSize + 15)
{
@@ -341,7 +341,7 @@ const CGFloat MGLUserLocationAnnotationArrowSize = MGLUserLocationAnnotationPuck
_accuracyRingLayer.opacity = 0.1;
_accuracyRingLayer.shouldRasterize = NO;
_accuracyRingLayer.allowsGroupOpacity = NO;
-
+
[self.layer addSublayer:_accuracyRingLayer];
}
@@ -396,7 +396,7 @@ const CGFloat MGLUserLocationAnnotationArrowSize = MGLUserLocationAnnotationPuck
[self.layer addSublayer:_dotBorderLayer];
}
-
+
// inner dot (pulsing, tinted)
//
if ( ! _dotLayer)
diff --git a/platform/ios/src/MGLLocationManager.m b/platform/ios/src/MGLLocationManager.m
index 7a9faf5c8d..d9c3d0e124 100644
--- a/platform/ios/src/MGLLocationManager.m
+++ b/platform/ios/src/MGLLocationManager.m
@@ -32,7 +32,7 @@ static NSString * const MGLLocationManagerRegionIdentifier = @"MGLLocationManage
if ([self isUpdatingLocation]) {
return;
}
-
+
[self configurePassiveStandardLocationManager];
[self startLocationServices];
}
@@ -78,7 +78,7 @@ static NSString * const MGLLocationManagerRegionIdentifier = @"MGLLocationManage
self.standardLocationManager.allowsBackgroundLocationUpdates = YES;
}
}
-
+
[self.standardLocationManager startUpdatingLocation];
self.updatingLocation = YES;
if ([self.delegate respondsToSelector:@selector(locationManagerDidStartLocationUpdates:)]) {
@@ -91,13 +91,13 @@ static NSString * const MGLLocationManagerRegionIdentifier = @"MGLLocationManage
if (self.backgroundLocationServiceTimeoutAllowedDate == nil) {
return;
}
-
+
if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive ||
[UIApplication sharedApplication].applicationState == UIApplicationStateInactive ) {
[self startBackgroundTimeoutTimer];
return;
}
-
+
NSTimeInterval timeIntervalSinceTimeoutAllowed = [[NSDate date] timeIntervalSinceDate:self.backgroundLocationServiceTimeoutAllowedDate];
if (timeIntervalSinceTimeoutAllowed > 0) {
[self.standardLocationManager stopUpdatingLocation];
diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h
index 1f2031e055..f1670ec49f 100644
--- a/platform/ios/src/MGLMapView.h
+++ b/platform/ios/src/MGLMapView.h
@@ -47,11 +47,11 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationVerticalAlignment) {
/**
An interactive, customizable map view with an interface similar to the one
provided by Apple’s MapKit.
-
+
Using `MGLMapView`, you can embed the map inside a view, allow users to
manipulate it with standard gestures, animate the map between different
viewpoints, and present information in the form of annotations and overlays.
-
+
The map view loads scalable vector tiles that conform to the
<a href="https://github.com/mapbox/vector-tile-spec">Mapbox Vector Tile Specification</a>.
It styles them with a style that conforms to the
@@ -59,26 +59,26 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationVerticalAlignment) {
Such styles can be designed in
<a href="https://www.mapbox.com/studio/">Mapbox Studio</a> and hosted on
mapbox.com.
-
+
A collection of Mapbox-hosted styles is available through the `MGLStyle`
class. These basic styles use
<a href="https://www.mapbox.com/developers/vector-tiles/mapbox-streets">Mapbox Streets</a>
or <a href="https://www.mapbox.com/satellite/">Mapbox Satellite</a> data
sources, but you can specify a custom style that makes use of your own data.
-
+
Mapbox-hosted vector tiles and styles require an API access token, which you
can obtain from the
<a href="https://www.mapbox.com/studio/account/tokens/">Mapbox account page</a>.
Access tokens associate requests to Mapbox’s vector tile and style APIs with
your Mapbox account. They also deter other developers from using your styles
without your permission.
-
+
Adding your own gesture recognizer to `MGLMapView` will block the corresponding
gesture recognizer built into `MGLMapView`. To avoid conflicts, define which
gesture takes precedence. For example, you can create your own
`UITapGestureRecognizer` that will be invoked only if the default `MGLMapView`
tap gesture fails:
-
+
```swift
let mapTapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(myCustomFunction))
for recognizer in mapView.gestureRecognizers! where recognizer is UITapGestureRecognizer {
@@ -86,7 +86,7 @@ typedef NS_ENUM(NSUInteger, MGLAnnotationVerticalAlignment) {
}
mapView.addGestureRecognizer(mapTapGestureRecognizer)
```
-
+
@note You are responsible for getting permission to use the map data and for
ensuring that your use adheres to the relevant terms of use.
@@ -99,7 +99,7 @@ IB_DESIGNABLE
/**
Initializes and returns a newly allocated map view with the specified frame
and the default style.
-
+
@param frame The frame for the view, measured in points.
@return An initialized map view.
*/
@@ -108,7 +108,7 @@ IB_DESIGNABLE
/**
Initializes and returns a newly allocated map view with the specified frame
and style URL.
-
+
@param frame The frame for the view, measured in points.
@param styleURL URL of the map style to display. The URL may be a full HTTP
or HTTPS URL, a Mapbox URL indicating the style’s map ID
@@ -122,7 +122,7 @@ IB_DESIGNABLE
/**
The receiver’s delegate.
-
+
A map view sends messages to its delegate to notify it of changes to its
contents or the viewpoint. The delegate also provides information about
annotations displayed on the map, such as the styles to apply to individual
@@ -134,17 +134,17 @@ IB_DESIGNABLE
/**
The style currently displayed in the receiver.
-
+
Unlike the `styleURL` property, this property is set to an object that allows
you to manipulate every aspect of the style locally.
-
+
If the style is loading, this property is set to `nil` until the style finishes
loading. If the style has failed to load, this property is set to `nil`.
Because the style loads asynchronously, you should manipulate it in the
`-[MGLMapViewDelegate mapView:didFinishLoadingStyle:]` or
`-[MGLMapViewDelegate mapViewDidFinishLoadingMap:]` method. It is not possible
to manipulate the style before it has finished loading.
-
+
@note The default styles provided by Mapbox contain sources and layers with
identifiers that will change over time. Applications that use APIs that
manipulate a style's sources and layers must first set the style URL to an
@@ -156,7 +156,7 @@ IB_DESIGNABLE
/**
URLs of the styles bundled with the library.
-
+
@deprecated Call the relevant class method of `MGLStyle` for the URL of a
particular default style.
*/
@@ -164,14 +164,14 @@ IB_DESIGNABLE
/**
URL of the style currently displayed in the receiver.
-
+
The URL may be a full HTTP or HTTPS URL, a Mapbox URL indicating the style’s
map ID (`mapbox://styles/{user}/{style}`), or a path to a local file
relative to the application’s resource path.
-
+
If you set this property to `nil`, the receiver will use the default style
and this property will automatically be set to that style’s URL.
-
+
If you want to modify the current style without replacing it outright, or if
you want to introspect individual style attributes, use the `style` property.
*/
@@ -179,12 +179,12 @@ IB_DESIGNABLE
/**
Reloads the style.
-
+
You do not normally need to call this method. The map view automatically
responds to changes in network connectivity by reloading the style. You may
need to call this method if you change the access token after a style has
loaded but before loading a style associated with a different Mapbox account.
-
+
This method does not bust the cache. Even if the style has recently changed on
the server, calling this method does not necessarily ensure that the map view
reflects those changes.
@@ -199,7 +199,7 @@ IB_DESIGNABLE
/**
The Mapbox logo, positioned in the lower-left corner.
-
+
@note The Mapbox terms of service, which governs the use of Mapbox-hosted
vector tiles and styles,
<a href="https://www.mapbox.com/help/mapbox-logo/">requires</a> most Mapbox
@@ -208,10 +208,10 @@ IB_DESIGNABLE
*/
@property (nonatomic, readonly) UIImageView *logoView;
-/**
+/**
A view showing legally required copyright notices and telemetry settings,
positioned at the bottom-right of the map view.
-
+
@note The Mapbox terms of service, which governs the use of Mapbox-hosted
vector tiles and styles,
<a href="https://www.mapbox.com/help/attribution/">requires</a> these
@@ -242,16 +242,16 @@ IB_DESIGNABLE
/**
A Boolean value indicating whether the map may display the user location.
-
+
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.
-
+
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`.
-
+
On iOS 8 and above, your app must specify a value for
`NSLocationWhenInUseUsageDescription` or `NSLocationAlwaysUsageDescription` in
its `Info.plist` to satisfy the requirements of the underlying Core Location
@@ -259,10 +259,10 @@ IB_DESIGNABLE
*/
@property (nonatomic, assign) BOOL showsUserLocation;
-/**
+/**
A Boolean value indicating whether the device’s current location is visible in
the map view.
-
+
Use `showsUserLocation` to control the visibility of the on-screen user
location annotation.
*/
@@ -273,10 +273,10 @@ IB_DESIGNABLE
*/
@property (nonatomic, readonly, nullable) MGLUserLocation *userLocation;
-/**
+/**
The mode used to track the user location. The default value is
`MGLUserTrackingModeNone`.
-
+
Changing the value of this property updates the map view with an animated
transition. If you don’t want to animate the change, use the
`-setUserTrackingMode:animated:` method instead.
@@ -285,7 +285,7 @@ IB_DESIGNABLE
/**
Sets the mode used to track the user location, with an optional transition.
-
+
@param mode The mode used to track the user location.
@param animated If `YES`, there is an animated transition from the current
viewport to a viewport that results from the change to `mode`. If `NO`, the
@@ -298,7 +298,7 @@ IB_DESIGNABLE
/**
The vertical alignment of the user location annotation within the receiver. The
default value is `MGLAnnotationVerticalAlignmentCenter`.
-
+
Changing the value of this property updates the map view with an animated
transition. If you don’t want to animate the change, use the
`-setUserLocationVerticalAlignment:animated:` method instead.
@@ -308,7 +308,7 @@ IB_DESIGNABLE
/**
Sets the vertical alignment of the user location annotation within the
receiver, with an optional transition.
-
+
@param alignment The vertical alignment of the user location annotation.
@param animated If `YES`, the user location annotation animates to its new
position within the map view. If `NO`, the user location annotation
@@ -325,17 +325,17 @@ IB_DESIGNABLE
/**
The geographic coordinate that is the subject of observation as the user
location is being tracked.
-
+
By default, this property is set to an invalid coordinate, indicating that
there is no target. In course tracking mode, the target forms one of two foci
in the viewport, the other being the user location annotation. Typically, this
property is set to a destination or waypoint in a real-time navigation scene.
As the user annotation moves toward the target, the map automatically zooms in
to fit both foci optimally within the viewport.
-
+
This property has no effect if the `userTrackingMode` property is set to a
value other than `MGLUserTrackingModeFollowWithCourse`.
-
+
Changing the value of this property updates the map view with an animated
transition. If you don’t want to animate the change, use the
`-setTargetCoordinate:animated:` method instead.
@@ -345,17 +345,17 @@ IB_DESIGNABLE
/**
Sets the geographic coordinate that is the subject of observation as the user
location is being tracked, with an optional transition animation.
-
+
By default, the target coordinate is set to an invalid coordinate, indicating
that there is no target. In course tracking mode, the target forms one of two
foci in the viewport, the other being the user location annotation. Typically,
the target is set to a destination or waypoint in a real-time navigation scene.
As the user annotation moves toward the target, the map automatically zooms in
to fit both foci optimally within the viewport.
-
+
This method has no effect if the `userTrackingMode` property is set to a value
other than `MGLUserTrackingModeFollowWithCourse`.
-
+
@param targetCoordinate The target coordinate to fit within the viewport.
@param animated If `YES`, the map animates to fit the target within the map
view. If `NO`, the map fits the target instantaneously.
@@ -367,11 +367,11 @@ IB_DESIGNABLE
/**
A Boolean value that determines whether the user may zoom the map in and
out, changing the zoom level.
-
+
When this property is set to `YES`, the default, the user may zoom the map
in and out by pinching two fingers or by double tapping, holding, and moving
the finger up and down.
-
+
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 zoom
programmatically.
@@ -381,10 +381,10 @@ IB_DESIGNABLE
/**
A Boolean value that determines whether the user may scroll around the map,
changing the center coordinate.
-
+
When this property is set to `YES`, the default, the user may scroll the map
by dragging or swiping with one finger.
-
+
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.
@@ -394,10 +394,10 @@ IB_DESIGNABLE
/**
A Boolean value that determines whether the user may rotate the map,
changing the direction.
-
+
When this property is set to `YES`, the default, the user may rotate the map
by moving two fingers in a circular motion.
-
+
This property controls only user interactions with the map. If you set the
value of this property to `NO`, you may still rotate the map
programmatically.
@@ -407,14 +407,14 @@ IB_DESIGNABLE
/**
A Boolean value that determines whether the user may change the pitch (tilt) of
the map.
-
+
When this property is set to `YES`, the default, the user may tilt the map by
vertically dragging two fingers.
-
+
This property controls only user interactions with the map. If you set the
value of this property to `NO`, you may still change the pitch of the map
programmatically.
-
+
The default value of this property is `YES`.
*/
@property(nonatomic, getter=isPitchEnabled) BOOL pitchEnabled;
@@ -434,10 +434,10 @@ IB_DESIGNABLE
/**
The geographic coordinate at the center of the map view.
-
+
Changing the value of this property centers the map on the new coordinate
without changing 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.
@@ -446,10 +446,10 @@ IB_DESIGNABLE
/**
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.
-
+
@param coordinate The new center coordinate for the map.
@param animated 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
@@ -460,7 +460,7 @@ IB_DESIGNABLE
/**
Changes the center coordinate and zoom level of the map and optionally animates
the change.
-
+
@param centerCoordinate The new center coordinate for the map.
@param zoomLevel The new zoom level for the map.
@param animated Specify `YES` if you want the map view to animate scrolling and
@@ -472,7 +472,7 @@ IB_DESIGNABLE
/**
Changes the center coordinate, zoom level, and direction of the map and
optionally animates the change.
-
+
@param centerCoordinate The new center coordinate for the map.
@param zoomLevel The new zoom level for the map.
@param direction The new direction for the map, measured in degrees relative to
@@ -486,7 +486,7 @@ IB_DESIGNABLE
/**
Changes the center coordinate, zoom level, and direction of the map, calling a
completion handler at the end of an optional animation.
-
+
@param centerCoordinate The new center coordinate for the map.
@param zoomLevel The new zoom level for the map.
@param direction The new direction for the map, measured in degrees relative to
@@ -499,13 +499,13 @@ IB_DESIGNABLE
- (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate zoomLevel:(double)zoomLevel direction:(CLLocationDirection)direction animated:(BOOL)animated completionHandler:(nullable void (^)(void))completion;
/** The zoom level of the receiver.
-
+
In addition to affecting the visual size and detail of features on the map,
the zoom level affects the size of the vector tiles that are loaded. At zoom
level 0, each tile covers the entire world map; at zoom level 1, it covers ¼
of the world; at zoom level 2, <sup>1</sup>⁄<sub>16</sub> of the world, and
so on.
-
+
Changing the value of this property updates the map view immediately. If you
want to animate the change, use the `-setZoomLevel:animated:` method instead.
*/
@@ -513,10 +513,10 @@ IB_DESIGNABLE
/**
Changes the zoom level of the map and optionally animates the change.
-
+
Changing the zoom level scales the map without changing the current center
coordinate.
-
+
@param zoomLevel The new zoom level for the map.
@param animated Specify `YES` if you want the map view to animate the change
to the new zoom level or `NO` if you want the map to display the new
@@ -550,11 +550,11 @@ IB_DESIGNABLE
/**
The heading of the map, measured in degrees clockwise from true north.
-
+
The value `0` means that the top edge of the map view corresponds to true
north. The value `90` means the top of the map is pointing due east. The
value `180` means the top of the map points due south, and so on.
-
+
Changing the value of this property updates the map view immediately. If you
want to animate the change, use the `-setDirection:animated:` method instead.
*/
@@ -562,13 +562,13 @@ IB_DESIGNABLE
/**
Changes the heading of the map and optionally animates the change.
-
+
@param direction The heading of the map, measured in degrees clockwise from
true north.
@param animated Specify `YES` if you want the map view to animate the change
to the new heading or `NO` if you want the map to display the new
heading immediately.
-
+
Changing the heading rotates the map without changing the current center
coordinate or zoom level.
*/
@@ -581,7 +581,7 @@ IB_DESIGNABLE
/**
Resets the map to the current style’s default viewport.
-
+
If the style doesn’t specify a default viewport, the map resets to a minimum
zoom level, a center coordinate of (0, 0), and a northern heading.
*/
@@ -589,7 +589,7 @@ IB_DESIGNABLE
/**
The coordinate bounds visible in the receiver’s viewport.
-
+
Changing the value of this property updates the receiver immediately. If you
want to animate the change, call `-setVisibleCoordinateBounds:animated:`
instead.
@@ -599,7 +599,7 @@ IB_DESIGNABLE
/**
Changes the receiver’s viewport to fit the given coordinate bounds,
optionally animating the change.
-
+
@param bounds The bounds that the viewport will show in its entirety.
@param animated Specify `YES` to animate the change by smoothly scrolling
and zooming or `NO` to immediately display the given bounds.
@@ -609,7 +609,7 @@ IB_DESIGNABLE
/**
Changes the receiver’s viewport to fit the given coordinate bounds and
optionally some additional padding on each side.
-
+
@param bounds The bounds that the viewport will show in its entirety.
@param insets The minimum padding (in screen points) that will be visible
around the given coordinate bounds.
@@ -621,7 +621,7 @@ IB_DESIGNABLE
/**
Changes the receiver’s viewport to fit all of the given coordinates and
optionally some additional padding on each side.
-
+
@param coordinates The coordinates that the viewport will show.
@param count The number of coordinates. This number must not be greater than
the number of elements in `coordinates`.
@@ -635,7 +635,7 @@ IB_DESIGNABLE
/**
Changes the receiver’s viewport to fit all of the given coordinates and
optionally some additional padding on each side.
-
+
@param coordinates The coordinates that the viewport will show.
@param count The number of coordinates. This number must not be greater than
the number of elements in `coordinates`.
@@ -686,7 +686,7 @@ IB_DESIGNABLE
/**
Moves the viewpoint to a different location with respect to the map with an
optional transition animation.
-
+
@param camera The new viewpoint.
@param animated Specify `YES` if you want the map view to animate the change to
the new viewpoint or `NO` if you want the map to display the new viewpoint
@@ -697,7 +697,7 @@ IB_DESIGNABLE
/**
Moves the viewpoint to a different location with respect to the map with an
optional transition duration and timing function.
-
+
@param camera The new viewpoint.
@param duration The amount of time, measured in seconds, that the transition
animation should take. Specify `0` to jump to the new viewpoint
@@ -711,7 +711,7 @@ IB_DESIGNABLE
/**
Moves the viewpoint to a different location with respect to the map with an
optional transition duration and timing function.
-
+
@param camera The new viewpoint.
@param duration The amount of time, measured in seconds, that the transition
animation should take. Specify `0` to jump to the new viewpoint
@@ -727,10 +727,10 @@ IB_DESIGNABLE
Moves the viewpoint to a different location using a transition animation that
evokes powered flight and a default duration based on the length of the flight
path.
-
+
The transition animation seamlessly incorporates zooming and panning to help
the user find his or her bearings even after traversing a great distance.
-
+
@param camera The new viewpoint.
@param completion The block to execute after the animation finishes.
*/
@@ -739,10 +739,10 @@ IB_DESIGNABLE
/**
Moves the viewpoint to a different location using a transition animation that
evokes powered flight and an optional transition duration.
-
+
The transition animation seamlessly incorporates zooming and panning to help
the user find his or her bearings even after traversing a great distance.
-
+
@param camera The new viewpoint.
@param duration The amount of time, measured in seconds, that the transition
animation should take. Specify `0` to jump to the new viewpoint
@@ -755,10 +755,10 @@ IB_DESIGNABLE
/**
Moves the viewpoint to a different location using a transition animation that
evokes powered flight and an optional transition duration and peak altitude.
-
+
The transition animation seamlessly incorporates zooming and panning to help
the user find his or her bearings even after traversing a great distance.
-
+
@param camera The new viewpoint.
@param duration The amount of time, measured in seconds, that the transition
animation should take. Specify `0` to jump to the new viewpoint
@@ -774,7 +774,7 @@ IB_DESIGNABLE
/**
Returns the camera that best fits the given coordinate bounds.
-
+
@param bounds The coordinate bounds to fit to the receiver’s viewport.
@return A camera object centered on the same location as the coordinate
bounds with zoom level as high (close to the ground) as possible while still
@@ -786,7 +786,7 @@ IB_DESIGNABLE
/**
Returns the camera that best fits the given coordinate bounds, optionally with
some additional padding on each side.
-
+
@param bounds The coordinate bounds to fit to the receiver’s viewport.
@param insets The minimum padding (in screen points) that would be visible
around the returned camera object if it were set as the receiver’s camera.
@@ -800,17 +800,17 @@ IB_DESIGNABLE
/**
Returns the point in this view’s coordinate system on which to "anchor" in
response to a user-initiated gesture.
-
+
For example, a pinch-to-zoom gesture would anchor the map at the midpoint of
the pinch.
-
+
If the `userTrackingMode` property is not `MGLUserTrackingModeNone`, the
user annotation is used as the anchor point.
-
+
Subclasses may override this method to provide specialized behavior - for
example, anchoring on the map’s center point to provide a "locked" zooming
mode.
-
+
@param gesture An anchorable user gesture.
@return The point on which to anchor in response to the gesture.
*/
@@ -819,17 +819,17 @@ IB_DESIGNABLE
/**
The distance from the edges of the map view’s frame to the edges of the map
view’s logical viewport.
-
+
When the value of this property is equal to `UIEdgeInsetsZero`, viewport
properties such as `centerCoordinate` assume a viewport that matches the map
view’s frame. Otherwise, those properties are inset, excluding part of the
frame from the viewport. For instance, if the only the top edge is inset, the
map center is effectively shifted downward.
-
+
When the map view’s superview is an instance of `UIViewController` whose
`automaticallyAdjustsScrollViewInsets` property is `YES`, the value of this
property may be overridden at any time.
-
+
Changing the value of this property updates the map view immediately. If you
want to animate the change, use the `-setContentInset:animated:` method
instead.
@@ -839,17 +839,17 @@ IB_DESIGNABLE
/**
Sets the distance from the edges of the map view’s frame to the edges of the
map view’s logical viewport with an optional transition animation.
-
+
When the value of this property is equal to `UIEdgeInsetsZero`, viewport
properties such as `centerCoordinate` assume a viewport that matches the map
view’s frame. Otherwise, those properties are inset, excluding part of the
frame from the viewport. For instance, if the only the top edge is inset, the
map center is effectively shifted downward.
-
+
When the map view’s superview is an instance of `UIViewController` whose
`automaticallyAdjustsScrollViewInsets` property is `YES`, the value of this
property may be overridden at any time.
-
+
@param contentInset The new values to inset the content by.
@param animated Specify `YES` if you want the map view to animate the change to
the content inset or `NO` if you want the map to inset the content
@@ -862,7 +862,7 @@ IB_DESIGNABLE
/**
Converts a point in the given view’s coordinate system to a geographic
coordinate.
-
+
@param point The point to convert.
@param view The view in whose coordinate system the point is expressed.
@return The geographic coordinate at the given point.
@@ -872,7 +872,7 @@ IB_DESIGNABLE
/**
Converts a geographic coordinate to a point in the given view’s coordinate
system.
-
+
@param coordinate The geographic coordinate to convert.
@param view The view in whose coordinate system the returned point should be
expressed. If this parameter is `nil`, the returned point is expressed
@@ -886,7 +886,7 @@ IB_DESIGNABLE
/**
Converts a rectangle in the given view’s coordinate system to a geographic
bounding box.
-
+
@param rect The rectangle to convert.
@param view The view in whose coordinate system the rectangle is expressed.
@return The geographic bounding box coextensive with the given rectangle.
@@ -896,7 +896,7 @@ IB_DESIGNABLE
/**
Converts a geographic bounding box to a rectangle in the given view’s
coordinate system.
-
+
@param bounds The geographic bounding box to convert.
@param view The view in whose coordinate system the returned rectangle should
be expressed. If this parameter is `nil`, the returned rectangle is
@@ -908,11 +908,11 @@ IB_DESIGNABLE
/**
Returns the distance spanned by one point in the map view’s coordinate system
at the given latitude and current zoom level.
-
+
The distance between points decreases as the latitude approaches the poles.
This relationship parallels the relationship between longitudinal coordinates
at different latitudes.
-
+
@param latitude The latitude of the geographic coordinate represented by the
point.
@return The distance in meters spanned by a single point.
@@ -925,7 +925,7 @@ IB_DESIGNABLE
/**
The complete list of annotations associated with the receiver. (read-only)
-
+
The objects in this array must adopt the `MGLAnnotation` protocol. If no
annotations are associated with the map view, the value of this property is
`nil`.
@@ -933,9 +933,9 @@ IB_DESIGNABLE
@property (nonatomic, readonly, nullable) NS_ARRAY_OF(id <MGLAnnotation>) *annotations;
/**
- The complete list of annotations associated with the receiver that are
+ The complete list of annotations associated with the receiver that are
currently visible.
-
+
The objects in this array must adopt the `MGLAnnotation` protocol. If no
annotations are associated with the map view or if no annotations associated
with the map view are currently visible, the value of this property is `nil`.
@@ -944,12 +944,12 @@ IB_DESIGNABLE
/**
Adds an annotation to the map view.
-
- @note `MGLMultiPolyline`, `MGLMultiPolygon`, `MGLShapeCollection`, and
- `MGLPointCollection` objects cannot be added to the map view at this time.
- Any multipoint, multipolyline, multipolygon, shape or point collection
+
+ @note `MGLMultiPolyline`, `MGLMultiPolygon`, `MGLShapeCollection`, and
+ `MGLPointCollection` objects cannot be added to the map view at this time.
+ Any multipoint, multipolyline, multipolygon, shape or point collection
object that is specified is silently ignored.
-
+
@param annotation The annotation object to add to the receiver. This object
must conform to the `MGLAnnotation` protocol. The map view retains the
annotation object. */
@@ -957,13 +957,13 @@ IB_DESIGNABLE
/**
Adds an array of annotations to the map view.
-
+
@note `MGLMultiPolyline`, `MGLMultiPolygon`, and `MGLShapeCollection` objects
cannot be added to the map view at this time. Nor can `MGLMultiPoint`
objects that are not instances of `MGLPolyline` or `MGLPolygon`. Any
multipoint, multipolyline, multipolygon, or shape collection objects that
are specified are silently ignored.
-
+
@param annotations An array of annotation objects. Each object in the array
must conform to the `MGLAnnotation` protocol. The map view retains each
individual annotation object.
@@ -972,11 +972,11 @@ IB_DESIGNABLE
/**
Removes an annotation from the map view, deselecting it if it is selected.
-
+
Removing an annotation object dissociates 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.
-
+
@param annotation The annotation object to remove. This object must conform
to the `MGLAnnotation` protocol
*/
@@ -985,11 +985,11 @@ IB_DESIGNABLE
/**
Removes an array of annotations from the map view, deselecting any selected
annotations in the array.
-
+
Removing annotation objects dissociates 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 given annotations.
-
+
@param annotations The array of annotation objects to remove. Objects in the
array must conform to the `MGLAnnotation` protocol.
*/
@@ -998,20 +998,20 @@ IB_DESIGNABLE
/**
Returns an `MGLAnnotationView` if the given annotation is currently associated
with a view, otherwise nil.
-
- @param annotation The annotation associated with the view.
+
+ @param annotation The annotation associated with the view.
Annotation must conform to the `MGLAnnotation` protocol.
*/
- (nullable MGLAnnotationView *)viewForAnnotation:(id <MGLAnnotation>)annotation;
/**
Returns a reusable annotation image object associated with its identifier.
-
+
For performance reasons, you should generally reuse `MGLAnnotationImage`
objects for identical-looking annotations in your map views. Dequeueing
saves time and memory during performance-critical operations such as
scrolling.
-
+
@param identifier A string identifying the annotation image to be reused.
This string is the same one you specify when initially returning the
annotation image object using the `-mapView:imageForAnnotation:` method.
@@ -1022,12 +1022,12 @@ IB_DESIGNABLE
/**
Returns a reusable annotation view object associated with its identifier.
-
+
For performance reasons, you should generally reuse `MGLAnnotationView`
objects for identical-looking annotations in your map views. Dequeueing
saves time and memory during performance-critical operations such as
scrolling.
-
+
@param identifier A string identifying the annotation view to be reused.
This string is the same one you specify when initially returning the
annotation view object using the `-mapView:viewForAnnotation:` method.
@@ -1037,12 +1037,12 @@ IB_DESIGNABLE
- (nullable __kindof MGLAnnotationView *)dequeueReusableAnnotationViewWithIdentifier:(NSString *)identifier;
/**
- Returns the list of annotations associated with the receiver that intersect with
+ Returns the list of annotations associated with the receiver that intersect with
the given rectangle.
-
+
@param rect A rectangle expressed in the map view’s coordinate system.
@return An array of objects that adopt the `MGLAnnotation` protocol or `nil` if
- no annotations associated with the map view are currently visible in the
+ no annotations associated with the map view are currently visible in the
rectangle.
*/
- (nullable NS_ARRAY_OF(id <MGLAnnotation>) *)visibleAnnotationsInRect:(CGRect)rect;
@@ -1051,7 +1051,7 @@ IB_DESIGNABLE
/**
The currently selected annotations.
-
+
Assigning a new array to this property selects only the first annotation in
the array.
*/
@@ -1059,10 +1059,10 @@ IB_DESIGNABLE
/**
Selects an annotation and displays a callout view for it.
-
+
If the given annotation is not visible within the current viewport, this
method has no effect.
-
+
@param annotation The annotation object to select.
@param animated If `YES`, the callout view is animated into position.
*/
@@ -1070,7 +1070,7 @@ IB_DESIGNABLE
/**
Deselects an annotation and hides its callout view.
-
+
@param annotation The annotation object to deselect.
@param animated If `YES`, the callout view is animated offscreen.
*/
@@ -1080,18 +1080,18 @@ IB_DESIGNABLE
/**
Adds a single overlay object to the map.
-
+
To remove an overlay from a map, use the `-removeOverlay:` method.
-
+
@param overlay The overlay object to add. This object must conform to the
`MGLOverlay` protocol. */
- (void)addOverlay:(id <MGLOverlay>)overlay;
/**
Adds an array of overlay objects to the map.
-
+
To remove multiple overlays from a map, use the `-removeOverlays:` method.
-
+
@param overlays An array of objects, each of which must conform to the
`MGLOverlay` protocol.
*/
@@ -1099,19 +1099,19 @@ IB_DESIGNABLE
/**
Removes a single overlay object from the map.
-
+
If the specified overlay is not currently associated with the map view, this
method does nothing.
-
+
@param overlay The overlay object to remove.
*/
- (void)removeOverlay:(id <MGLOverlay>)overlay;
/**
Removes one or more overlay objects from the map.
-
+
If a given overlay object is not associated with the map view, it is ignored.
-
+
@param overlays An array of objects, each of which conforms to the `MGLOverlay`
protocol.
*/
@@ -1121,12 +1121,12 @@ IB_DESIGNABLE
/**
Returns an array of rendered map features that intersect with a given point.
-
+
This method may return features from any of the map’s style layers. To restrict
the search to a particular layer or layers, use the
`-visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:` method. For more
information about searching for map features, see that method’s documentation.
-
+
@param point A point expressed in the map view’s coordinate system.
@return An array of objects conforming to the `MGLFeature` protocol that
represent features in the sources used by the current style.
@@ -1136,13 +1136,13 @@ IB_DESIGNABLE
/**
Returns an array of rendered map features that intersect with a given point,
restricted to the given style layers.
-
+
Each object in the returned array represents a feature rendered by the
current style and provides access to attributes specified by the relevant
<a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources">tile sources</a>.
The returned array includes features specified in vector and GeoJSON tile
sources but does not include anything from raster, image, or video sources.
-
+
Only visible features are returned. For example, suppose the current style uses
the
<a href="https://www.mapbox.com/vector-tiles/mapbox-streets/">Mapbox Streets source</a>,
@@ -1155,22 +1155,22 @@ IB_DESIGNABLE
other attributes). The dictionary contains only the attributes provided by the
tile source; it does not include computed attribute values or rules about how
the feature is rendered by the current style.
-
+
The returned array is sorted by z-order, starting with the topmost rendered
feature and ending with the bottommost rendered feature. A feature that is
rendered multiple times due to wrapping across the antimeridian at low zoom
levels is included only once, subject to the caveat that follows.
-
+
Features come from tiled vector data or GeoJSON data that is converted to tiles
internally, so feature geometries are clipped at tile boundaries and features
may appear duplicated across tiles. For example, suppose the specified point
lies along a road that spans the screen. The resulting array includes those
parts of the road that lie within the map tile that contain the specified
point, even if the road extends into other tiles.
-
+
To find out the layer names in a particular style, view the style in
<a href="https://www.mapbox.com/studio/">Mapbox Studio</a>.
-
+
@note Layer identifiers are not guaranteed to exist across styles or different
versions of the same style. Applications that use this API must first set the
style URL to an explicitly versioned style using a convenience method like
@@ -1178,7 +1178,7 @@ IB_DESIGNABLE
inspectable in Interface Builder, or a manually constructed `NSURL`. This
approach also avoids layer identifer name changes that will occur in the default
style’s layers over time.
-
+
@param point A point expressed in the map view’s coordinate system.
@param styleLayerIdentifiers A set of strings that correspond to the names of
layers defined in the current style. Only the features contained in these
@@ -1191,12 +1191,12 @@ IB_DESIGNABLE
/**
Returns an array of rendered map features that intersect with the given
rectangle.
-
+
This method may return features from any of the map’s style layers. To restrict
the search to a particular layer or layers, use the
`-visibleFeaturesAtPoint:inStyleLayersWithIdentifiers:` method. For more
information about searching for map features, see that method’s documentation.
-
+
@param rect A rectangle expressed in the map view’s coordinate system.
@return An array of objects conforming to the `MGLFeature` protocol that
represent features in the sources used by the current style.
@@ -1206,13 +1206,13 @@ IB_DESIGNABLE
/**
Returns an array of rendered map features that intersect with the given
rectangle, restricted to the given style layers.
-
+
Each object in the returned array represents a feature rendered by the
current style and provides access to attributes specified by the relevant
<a href="https://www.mapbox.com/mapbox-gl-style-spec/#sources">tile sources</a>.
The returned array includes features specified in vector and GeoJSON tile
sources but does not include anything from raster, image, or video sources.
-
+
Only visible features are returned. For example, suppose the current style uses
the
<a href="https://www.mapbox.com/vector-tiles/mapbox-streets/">Mapbox Streets source</a>,
@@ -1225,12 +1225,12 @@ IB_DESIGNABLE
dictionary contains only the attributes provided by the tile source; it does
not include computed attribute values or rules about how the feature is
rendered by the current style.
-
+
The returned array is sorted by z-order, starting with the topmost rendered
feature and ending with the bottommost rendered feature. A feature that is
rendered multiple times due to wrapping across the antimeridian at low zoom
levels is included only once, subject to the caveat that follows.
-
+
Features come from tiled vector data or GeoJSON data that is converted to tiles
internally, so feature geometries are clipped at tile boundaries and features
may appear duplicated across tiles. For example, suppose the specified
@@ -1238,10 +1238,10 @@ IB_DESIGNABLE
includes those parts of the road that lie within the map tiles covering the
specified rectangle, even if the road extends into other tiles. The portion of
the road within each map tile is included individually.
-
+
To find out the layer names in a particular style, view the style in
<a href="https://www.mapbox.com/studio/">Mapbox Studio</a>.
-
+
@note Layer identifiers are not guaranteed to exist across styles or different
versions of the same style. Applications that use this API must first set the
style URL to an explicitly versioned style using a convenience method like
@@ -1249,7 +1249,7 @@ IB_DESIGNABLE
inspectable in Interface Builder, or a manually constructed `NSURL`. This
approach also avoids layer identifer name changes that will occur in the default
style’s layers over time.
-
+
@param rect A rectangle expressed in the map view’s coordinate system.
@param styleLayerIdentifiers A set of strings that correspond to the names of
layers defined in the current style. Only the features contained in these
@@ -1263,7 +1263,7 @@ IB_DESIGNABLE
/**
The options that determine which debugging aids are shown on the map.
-
+
These options are all disabled by default and should remain disabled in
released software for performance and aesthetic reasons.
*/
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 04e9e9bb4b..35ad583081 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -99,7 +99,7 @@ const double MGLMinimumZoomLevelForUserTracking = 10.5;
/// Initial zoom level when entering user tracking mode from a low zoom level.
const double MGLDefaultZoomLevelForUserTracking = 14.0;
-const NSUInteger MGLTargetFrameInterval = 1; //Target FPS will be 60 divided by this value
+const NSUInteger MGLTargetFrameInterval = 1; // Target FPS will be 60 divided by this value
/// Tolerance for snapping to true north, measured in degrees in either direction.
const CLLocationDirection MGLToleranceForSnappingToNorth = 7;
@@ -277,7 +277,7 @@ public:
MGLAnnotationTagContextMap _annotationContextsByAnnotationTag;
MGLAnnotationObjectTagMap _annotationTagsByAnnotation;
-
+
/// Tag of the selected annotation. If the user location annotation is selected, this ivar is set to `MGLAnnotationTagNotFound`.
MGLAnnotationTag _selectedAnnotationTag;
@@ -312,7 +312,7 @@ public:
BOOL _delegateHasLineWidthsForShapeAnnotations;
MGLCompassDirectionFormatter *_accessibilityCompassFormatter;
-
+
NS_ARRAY_OF(MGLAttributionInfo *) *_attributionInfos;
}
@@ -368,7 +368,7 @@ public:
- (void)setStyleURL:(nullable NSURL *)styleURL
{
if (_isTargetingInterfaceBuilder) return;
-
+
if ( ! styleURL)
{
styleURL = [MGLStyle streetsStyleURLWithVersion:MGLStyleDefaultVersion];
@@ -1435,9 +1435,9 @@ public:
/**
Returns the annotation that would be selected by a tap gesture recognizer.
-
+
This is used when a gesture is recognized, and to check if the gesture should be recognized.
-
+
@param singleTap An in progress tap gesture recognizer.
@param persist True to remember the cycleable set of annotations. @see annotationTagAtPoint:persistingResults
*/
@@ -1457,9 +1457,9 @@ public:
// Get the tap point within the custom hit test layer.
tapPointForUserLocation = [singleTap locationInView:self.userLocationAnnotationView];
}
-
+
CALayer *hitLayer = [self.userLocationAnnotationView.hitTestLayer hitTest:tapPointForUserLocation];
-
+
if (hitLayer)
{
if ( ! _userLocationAnnotationIsSelected)
@@ -1469,7 +1469,7 @@ public:
return nil;
}
}
-
+
// Handle the case of an offset annotation view by converting the tap point to be the geo location
// of the annotation itself that the view represents
for (MGLAnnotationView *view in self.annotationContainerView.annotationViews)
@@ -1481,7 +1481,7 @@ public:
}
}
}
-
+
MGLAnnotationTag hitAnnotationTag = [self annotationTagAtPoint:tapPoint persistingResults:persist];
if (hitAnnotationTag != MGLAnnotationTagNotFound)
{
@@ -1492,7 +1492,7 @@ public:
return annotation;
}
}
-
+
return nil;
}
@@ -1653,7 +1653,7 @@ public:
}
else if (gestureRecognizer == _singleTapGestureRecognizer)
{
- //Gesture will be recognized if it could deselect an annotation
+ // Gesture will be recognized if it could deselect an annotation
if(!self.selectedAnnotation)
{
id<MGLAnnotation>annotation = [self annotationForGestureRecognizer:(UITapGestureRecognizer*)gestureRecognizer persistingResults:NO];
@@ -1738,16 +1738,16 @@ public:
cancelButtonTitle:NSLocalizedStringWithDefaultValue(@"CANCEL", nil, nil, @"Cancel", @"")
destructiveButtonTitle:nil
otherButtonTitles:nil];
-
+
_attributionInfos = [self.style attributionInfosWithFontSize:[UIFont buttonFontSize] linkColor:nil];
for (MGLAttributionInfo *info in _attributionInfos)
{
NSString *title = [info.title.string mgl_titleCasedStringWithLocale:[NSLocale currentLocale]];
[self.attributionSheet addButtonWithTitle:title];
}
-
+
[self.attributionSheet addButtonWithTitle:NSLocalizedStringWithDefaultValue(@"TELEMETRY_NAME", nil, nil, @"Mapbox Telemetry", @"Action in attribution sheet")];
-
+
[self.attributionSheet showFromRect:self.attributionButton.frame inView:self animated:YES];
}
@@ -2859,12 +2859,12 @@ public:
{
return nil;
}
-
+
std::vector<MGLAnnotationTag> annotationTags = [self annotationTagsInRect:rect];
if (annotationTags.size())
{
NSMutableArray *annotations = [NSMutableArray arrayWithCapacity:annotationTags.size()];
-
+
for (auto const& annotationTag: annotationTags)
{
if (!_annotationContextsByAnnotationTag.count(annotationTag))
@@ -2874,10 +2874,10 @@ public:
MGLAnnotationContext annotationContext = _annotationContextsByAnnotationTag.at(annotationTag);
[annotations addObject:annotationContext.annotation];
}
-
+
return [annotations copy];
}
-
+
return nil;
}
@@ -2901,7 +2901,7 @@ public:
{
return MGLAnnotationTagNotFound;
}
-
+
return _annotationTagsByAnnotation.at(annotation);
}
@@ -4577,14 +4577,14 @@ public:
MGLAnnotationTag tag = [self annotationTagForAnnotation:self.selectedAnnotation];
MGLAnnotationContext &annotationContext = _annotationContextsByAnnotationTag.at(tag);
MGLAnnotationView *annotationView = annotationContext.annotationView;
-
+
CGRect rect = [self positioningRectForCalloutForAnnotationWithTag:tag];
-
+
if (annotationView)
{
rect = annotationView.frame;
}
-
+
if ( ! CGRectIntersectsRect(rect, self.frame)) {
[self deselectAnnotation:self.selectedAnnotation animated:NO];
}
@@ -4733,11 +4733,11 @@ public:
CGFloat widthAdjustment = self.camera.pitch > 0.0 ? 0.0 : -_largestAnnotationViewSize.width * 2.0;
CGFloat heightAdjustment = self.camera.pitch > 0.0 ? 0.0 : -_largestAnnotationViewSize.height * 2.0;
CGRect viewPort = CGRectInset(self.bounds, widthAdjustment, heightAdjustment);
-
+
NSArray *visibleAnnotations = [self visibleAnnotationsInRect:viewPort];
NSMutableArray *offscreenAnnotations = [self.annotations mutableCopy];
[offscreenAnnotations removeObjectsInArray:visibleAnnotations];
-
+
// Update the center of visible annotation views
for (id<MGLAnnotation> annotation in visibleAnnotations)
{
@@ -4792,7 +4792,7 @@ public:
NSAssert(annotationTag != MGLAnnotationTagNotFound, @"-visibleAnnotationsInRect: returned unrecognized annotation");
MGLAnnotationContext &annotationContext = _annotationContextsByAnnotationTag.at(annotationTag);
UIView *annotationView = annotationContext.annotationView;
-
+
if (annotationView)
{
CLLocationCoordinate2D coordinate = annotation.coordinate;
@@ -4827,27 +4827,27 @@ public:
{
UIView <MGLCalloutView> *calloutView = self.calloutViewForSelectedAnnotation;
id <MGLAnnotation> annotation = calloutView.representedObject;
-
+
BOOL isAnchoredToAnnotation = (calloutView
&& annotation
&& [calloutView respondsToSelector:@selector(isAnchoredToAnnotation)]
&& calloutView.isAnchoredToAnnotation);
-
+
if (isAnchoredToAnnotation)
{
MGLAnnotationTag tag = [self annotationTagForAnnotation:annotation];
MGLAnnotationContext &annotationContext = _annotationContextsByAnnotationTag.at(tag);
MGLAnnotationView *annotationView = annotationContext.annotationView;
-
+
CGRect rect = [self positioningRectForCalloutForAnnotationWithTag:tag];
-
+
if (annotationView)
{
rect = annotationView.frame;
}
-
+
CGPoint point = CGPointMake(CGRectGetMidX(rect), CGRectGetMinY(rect));
-
+
if ( ! CGPointEqualToPoint(calloutView.center, point)) {
calloutView.center = point;
}
diff --git a/platform/ios/src/MGLMapViewDelegate.h b/platform/ios/src/MGLMapViewDelegate.h
index 09e2465a28..8a57e15f7a 100644
--- a/platform/ios/src/MGLMapViewDelegate.h
+++ b/platform/ios/src/MGLMapViewDelegate.h
@@ -24,10 +24,10 @@ NS_ASSUME_NONNULL_BEGIN
/**
Tells the delegate that the viewpoint depicted by the map view is about to
change.
-
+
This method is called whenever the currently displayed map camera will start
changing for any reason.
-
+
@param mapView The map view whose viewpoint will change.
@param animated Whether the change will cause an animated effect on the map.
*/
@@ -35,14 +35,14 @@ NS_ASSUME_NONNULL_BEGIN
/**
Tells the delegate that the viewpoint depicted by the map view is changing.
-
+
This method is called as the currently displayed map camera changes as part of
an animation, whether due to a user gesture or due to a call to a method such
as `-[MGLMapView setCamera:animated:]`. During the animation, this method may
be called many times to report updates to the viewpoint. Therefore, your
implementation of this method should be as lightweight as possible to avoid
affecting performance.
-
+
@param mapView The map view whose viewpoint is changing.
*/
- (void)mapViewRegionIsChanging:(MGLMapView *)mapView;
@@ -50,10 +50,10 @@ NS_ASSUME_NONNULL_BEGIN
/**
Tells the delegate that the viewpoint depicted by the map view has finished
changing.
-
+
This method is called whenever the currently displayed map camera has finished
changing, after any calls to `-mapViewRegionIsChanging:` due to animation.
-
+
@param mapView The map view whose viewpoint has changed.
@param animated Whether the change caused an animated effect on the map.
*/
@@ -63,20 +63,20 @@ NS_ASSUME_NONNULL_BEGIN
/**
Tells the delegate that the map view will begin to load.
-
+
This method is called whenever the map view starts loading, including when a
new style has been set and the map must reload.
-
+
@param mapView The map view that is starting to load.
*/
- (void)mapViewWillStartLoadingMap:(MGLMapView *)mapView;
/**
Tells the delegate that the map view has finished loading.
-
+
This method is called whenever the map view finishes loading, either after the
initial load or after a style change has forced a reload.
-
+
@param mapView The map view that has finished loading.
*/
- (void)mapViewDidFinishLoadingMap:(MGLMapView *)mapView;
@@ -84,11 +84,11 @@ NS_ASSUME_NONNULL_BEGIN
/**
Tells the delegate that the map view was unable to load data needed for
displaying the map.
-
+
This method may be called for a variety of reasons, including a network
connection failure or a failure to fetch the style from the server. You can use
the given error message to notify the user that map data is unavailable.
-
+
@param mapView The map view that is unable to load the data.
@param error The reason the data could not be loaded.
*/
@@ -102,39 +102,39 @@ NS_ASSUME_NONNULL_BEGIN
/**
Tells the delegate that the map view is about to redraw.
-
+
This method is called any time the map view needs to redraw due to a change in
the viewpoint or style property transition. This method may be called very
frequently, even moreso than `-mapViewRegionIsChanging:`. Therefore, your
implementation of this method should be as lightweight as possible to avoid
affecting performance.
-
+
@param mapView The map view that is about to redraw.
*/
- (void)mapViewWillStartRenderingFrame:(MGLMapView *)mapView;
/**
Tells the delegate that the map view has just redrawn.
-
+
This method is called any time the map view needs to redraw due to a change in
the viewpoint or style property transition. This method may be called very
frequently, even moreso than `-mapViewRegionIsChanging:`. Therefore, your
implementation of this method should be as lightweight as possible to avoid
affecting performance.
-
+
@param mapView The map view that has just redrawn.
*/
- (void)mapViewDidFinishRenderingFrame:(MGLMapView *)mapView fullyRendered:(BOOL)fullyRendered;
/**
Tells the delegate that the map has just finished loading a style.
-
+
This method is called during the initialization of the map view and after any
subsequent loading of a new style. This method is called between the
`-mapViewWillStartRenderingMap:` and `-mapViewDidFinishRenderingMap:` delegate
methods. Changes to sources or layers of the current style do not cause this
method to be called.
-
+
This method is the earliest opportunity to modify the layout or appearance of
the current style before the map view is displayed to the user.
@@ -147,37 +147,37 @@ NS_ASSUME_NONNULL_BEGIN
/**
Tells the delegate that the map view will begin tracking the user’s location.
-
+
This method is called when the value of the `showsUserLocation` property
changes to `YES`.
-
+
@param mapView The map view that is tracking the user’s location.
*/
- (void)mapViewWillStartLocatingUser:(MGLMapView *)mapView;
/**
Tells the delegate that the map view has stopped tracking the user’s location.
-
+
This method is called when the value of the `showsUserLocation` property
changes to `NO`.
-
+
@param mapView The map view that is tracking the user’s location.
*/
- (void)mapViewDidStopLocatingUser:(MGLMapView *)mapView;
/**
Tells the delegate that the location of the user was updated.
-
+
While the `showsUserLocation` property is set to `YES`, this method is called
whenever a new location update is received by the map view. This method is also
called if the map view’s user tracking mode is set to
`MGLUserTrackingModeFollowWithHeading` and the heading changes, or if it is set
to `MGLUserTrackingModeFollowWithCourse` and the course changes.
-
+
This method is not called if the application is currently running in the
background. If you want to receive location updates while running in the
background, you must use the Core Location framework.
-
+
@param mapView The map view that is tracking the user’s location.
@param userLocation The location object representing the user’s latest
location. This property may be `nil`.
@@ -186,7 +186,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
Tells the delegate that an attempt to locate the user’s position failed.
-
+
@param mapView The map view that is tracking the user’s location.
@param error An error object containing the reason why location tracking
failed.
@@ -195,10 +195,10 @@ NS_ASSUME_NONNULL_BEGIN
/**
Tells the delegate that the map view’s user tracking mode has changed.
-
+
This method is called after the map view asynchronously changes to reflect the
new user tracking mode, for example by beginning to zoom or rotate.
-
+
@param mapView The map view that changed its tracking mode.
@param mode The new tracking mode.
@param animated Whether the change caused an animated effect on the map.
@@ -210,16 +210,16 @@ NS_ASSUME_NONNULL_BEGIN
/**
Returns an annotation image object to mark the given point annotation object on
the map.
-
+
Implement this method to mark a point annotation with a static image. If you
want to mark a particular point annotation with an annotation view instead,
omit this method or have it return `nil` for that annotation, then implement
`-mapView:viewForAnnotation:`.
-
+
Static annotation images use less memory and draw more quickly than annotation
views. On the other hand, annotation views are compatible with UIKit, Core
Animation, and other Cocoa Touch frameworks.
-
+
@param mapView The map view that requested the annotation image.
@param annotation The object representing the annotation that is about to be
displayed.
@@ -233,7 +233,7 @@ NS_ASSUME_NONNULL_BEGIN
A value of `0.0` results in a completely transparent shape. A value of `1.0`,
the default, results in a completely opaque shape.
-
+
This method sets the opacity of an entire shape, inclusive of its stroke and
fill. To independently set the values for stroke or fill, specify an alpha
component in the color returned by `-mapView:strokeColorForShapeAnnotation:` or
@@ -247,13 +247,13 @@ NS_ASSUME_NONNULL_BEGIN
/**
Returns the color to use when rendering the outline of a shape annotation.
-
+
The default stroke color is the map view’s tint color. If a pattern color is
specified, the result is undefined.
-
+
Opacity may be set by specifying an alpha component. The default alpha value is
`1.0` and results in a completely opaque stroke.
-
+
@param mapView The map view rendering the shape annotation.
@param annotation The annotation being rendered.
@return A color to use for the shape outline.
@@ -262,13 +262,13 @@ NS_ASSUME_NONNULL_BEGIN
/**
Returns the color to use when rendering the fill of a polygon annotation.
-
+
The default fill color is the map view’s tint color. If a pattern color is
specified, the result is undefined.
-
+
Opacity may be set by specifying an alpha component. The default alpha value is
`1.0` and results in a completely opaque shape.
-
+
@param mapView The map view rendering the polygon annotation.
@param annotation The annotation being rendered.
@return The polygon’s interior fill color.
@@ -278,9 +278,9 @@ NS_ASSUME_NONNULL_BEGIN
/**
Returns the line width in points to use when rendering the outline of a
polyline annotation.
-
+
By default, the polyline is outlined with a line `3.0` points wide.
-
+
@param mapView The map view rendering the polygon annotation.
@param annotation The annotation being rendered.
@return A line width for the polyline, measured in points.
@@ -291,16 +291,16 @@ NS_ASSUME_NONNULL_BEGIN
/**
Returns a view object to mark the given point annotation object on the map.
-
+
Implement this method to mark a point annotation with a view object. If you
want to mark a particular point annotation with a static image instead, omit
this method or have it return `nil` for that annotation, then implement
`-mapView:imageForAnnotation:` instead.
-
+
Annotation views are compatible with UIKit, Core Animation, and other Cocoa
Touch frameworks. On the other hand, static annotation images use less memory
and draw more quickly than annotation views.
-
+
The user location annotation view can also be customized via this method. When
`annotation` is an instance of `MGLUserLocation` (or equal to the map view’s
`userLocation` property), return an instance of `MGLUserLocationAnnotationView`
@@ -317,10 +317,10 @@ NS_ASSUME_NONNULL_BEGIN
/**
Tells the delegate that one or more annotation views have been added and
positioned on the map.
-
+
This method is called just after the views are added to the map. You can
implement this method to animate the addition of the annotation views.
-
+
@param mapView The map view to which the annotation views were added.
@param annotationViews An array of `MGLAnnotationView` objects representing the
views that were added.
@@ -331,13 +331,13 @@ NS_ASSUME_NONNULL_BEGIN
/**
Tells the delegate that one of its annotations was selected.
-
+
You can use this method to track changes in the selection state of annotations.
-
+
If the annotation is associated with an annotation view, you can also implement
`-mapView:didSelectAnnotationView:`, which is called immediately after this
method is called.
-
+
@param mapView The map view containing the annotation.
@param annotation The annotation that was selected.
*/
@@ -345,13 +345,13 @@ NS_ASSUME_NONNULL_BEGIN
/**
Tells the delegate that one of its annotations was deselected.
-
+
You can use this method to track changes in the selection state of annotations.
-
+
If the annotation is associated with an annotation view, you can also implement
`-mapView:didDeselectAnnotationView:`, which is called immediately after this
method is called.
-
+
@param mapView The map view containing the annotation.
@param annotation The annotation that was deselected.
*/
@@ -359,15 +359,15 @@ NS_ASSUME_NONNULL_BEGIN
/**
Tells the delegate that one of its annotation views was selected.
-
+
You can use this method to track changes in the selection state of annotation
views.
-
+
This method is only called for annotation views. To track changes in the
selection state of all annotations, including those associated with static
annotation images, implement `-mapView:didSelectAnnotation:`, which is called
immediately before this method is called.
-
+
@param mapView The map view containing the annotation.
@param annotationView The annotation view that was selected.
*/
@@ -375,15 +375,15 @@ NS_ASSUME_NONNULL_BEGIN
/**
Tells the delegate that one of its annotation views was deselected.
-
+
You can use this method to track changes in the selection state of annotation
views.
-
+
This method is only called for annotation views. To track changes in the
selection state of all annotations, including those associated with static
annotation images, implement `-mapView:didDeselectAnnotation:`, which is called
immediately before this method is called.
-
+
@param mapView The map view containing the annotation.
@param annotationView The annotation view that was deselected.
*/
@@ -394,10 +394,10 @@ NS_ASSUME_NONNULL_BEGIN
/**
Returns a Boolean value indicating whether the annotation is able to display
extra information in a callout bubble.
-
+
This method is called after an annotation is selected, before any callout is
displayed for the annotation.
-
+
If the return value is `YES`, a callout view is shown when the user taps on an
annotation, selecting it. The default callout displays the annotation’s title
and subtitle. You can add accessory views to either end of the callout by
@@ -405,11 +405,11 @@ NS_ASSUME_NONNULL_BEGIN
`-mapView:rightCalloutAccessoryViewForAnnotation:` methods. You can further
customize the callout’s contents by implementing the
`-mapView:calloutViewForAnnotation:` method.
-
+
If the return value is `NO`, or if this method is absent from the delegate, or
if the annotation lacks a title, the annotation will not show a callout even
when selected.
-
+
@param mapView The map view that has selected the annotation.
@param annotation The object representing the annotation.
@return A Boolean value indicating whether the annotation should show a
@@ -419,14 +419,14 @@ NS_ASSUME_NONNULL_BEGIN
/**
Returns a callout view to display for the given annotation.
-
+
If this method is present in the delegate, it must return a new instance of a
view dedicated to display the callout. The returned view will be configured by
the map view.
-
+
If this method is absent from the delegate, or if it returns `nil`, a standard,
two-line, bubble-like callout view is displayed by default.
-
+
@param mapView The map view that requested the callout view.
@param annotation The object representing the annotation.
@return A view conforming to the `MGLCalloutView` protocol, or `nil` to use the
@@ -436,24 +436,24 @@ NS_ASSUME_NONNULL_BEGIN
/**
Returns the view to display on the left side of the standard callout bubble.
-
+
The left callout view is typically used to convey information about the
annotation or to link to custom information provided by your application.
-
+
If the view you specify is a descendant of the `UIControl` class, you can use
the map view’s delegate to receive notifications when your control is tapped,
by implementing the `-mapView:annotation:calloutAccessoryControlTapped:`
method. If the view you specify does not descend from `UIControl`, your view is
responsible for handling any touch events within its bounds.
-
+
If this method is absent from the delegate, or if it returns `nil`, the
standard callout view has no accessory view on its left side. The return value
of this method is ignored if `-mapView:calloutViewForAnnotation:` is present in
the delegate.
-
+
To display a view on the callout’s right side, implement the
`-mapView:rightCalloutAccessoryViewForAnnotation:` method.
-
+
@param mapView The map view presenting the annotation callout.
@param annotation The object representing the annotation with the callout.
@return The accessory view to display.
@@ -462,24 +462,24 @@ NS_ASSUME_NONNULL_BEGIN
/**
Returns the view to display on the right side of the standard callout bubble.
-
+
The right callout view is typically used to convey information about the
annotation or to link to custom information provided by your application.
-
+
If the view you specify is a descendant of the `UIControl` class, you can use
the map view’s delegate to receive notifications when your control is tapped,
by implementing the `-mapView:annotation:calloutAccessoryControlTapped:`
method. If the view you specify does not descend from `UIControl`, your view is
responsible for handling any touch events within its bounds.
-
+
If this method is absent from the delegate, or if it returns `nil`, the
standard callout view has no accessory view on its right side. The return value
of this method is ignored if `-mapView:calloutViewForAnnotation:` is present in
the delegate.
-
+
To display a view on the callout’s left side, implement the
`-mapView:leftCalloutAccessoryViewForAnnotation:` method.
-
+
@param mapView The map view presenting the annotation callout.
@param annotation The object representing the annotation with the callout.
@return The accessory view to display.
@@ -489,7 +489,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
Tells the delegate that the user tapped one of the accessory controls in the
annotation’s callout view.
-
+
In a standard callout view, accessory views contain custom content and are
positioned on either side of the annotation title text. If an accessory view
you specify is a descendant of the `UIControl` class, the map view calls this
@@ -498,13 +498,13 @@ NS_ASSUME_NONNULL_BEGIN
For example, if your control displays additional information about the
annotation, you could use this method to present a modal panel with that
information.
-
+
If your custom accessory views are not descendants of the `UIControl` class,
the map view does not call this method. If the annotation has a custom callout
view via the `-mapView:calloutViewForAnnotation:` method, you can specify the
custom accessory views using the `MGLCalloutView` protocol’s
`leftAccessoryView` and `rightAccessoryView` properties.
-
+
@param mapView The map view containing the specified annotation.
@param annotation The annotation whose accessory view was tapped.
@param control The control that was tapped.
@@ -513,17 +513,17 @@ NS_ASSUME_NONNULL_BEGIN
/**
Tells the delegate that the user tapped on an annotation’s callout view.
-
+
This method is called when the user taps on the body of the callout view, as
opposed to the callout’s left or right accessory view. If the annotation has a
custom callout view via the `-mapView:calloutViewForAnnotation:` method, this
method is only called whenever the callout view calls its delegate’s
`-[MGLCalloutViewDelegate calloutViewTapped:]` method.
-
+
If this method is present on the delegate, the standard callout view’s body
momentarily highlights when the user taps it, whether or not this method does
anything in response to the tap.
-
+
@param mapView The map view containing the specified annotation.
@param annotation The annotation whose callout was tapped.
*/
diff --git a/platform/ios/src/MGLMapboxEvents.m b/platform/ios/src/MGLMapboxEvents.m
index 744b80047b..7b28ccf1a8 100644
--- a/platform/ios/src/MGLMapboxEvents.m
+++ b/platform/ios/src/MGLMapboxEvents.m
@@ -94,12 +94,12 @@ const NSTimeInterval MGLFlushInterval = 180;
- (NSString *)sysInfoByName:(char *)typeSpecifier {
size_t size;
sysctlbyname(typeSpecifier, NULL, &size, NULL, 0);
-
+
char *answer = malloc(size);
sysctlbyname(typeSpecifier, answer, &size, NULL, 0);
-
+
NSString *results = [NSString stringWithCString:answer encoding: NSUTF8StringEncoding];
-
+
free(answer);
return results;
}
@@ -180,11 +180,11 @@ const NSTimeInterval MGLFlushInterval = 180;
// Events Control
_eventQueue = [[NSMutableArray alloc] init];
-
+
// Setup Date Format
_rfc3339DateFormatter = [[NSDateFormatter alloc] init];
NSLocale *enUSPOSIXLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"];
-
+
[_rfc3339DateFormatter setLocale:enUSPOSIXLocale];
[_rfc3339DateFormatter setDateFormat:@"yyyy'-'MM'-'dd'T'HH':'mm':'ssZ"];
// Clear Any System TimeZone Cache
@@ -201,10 +201,10 @@ const NSTimeInterval MGLFlushInterval = 180;
} else {
self.canEnableDebugLogging = YES;
}
-
+
// Watch for changes to telemetry settings by the user
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userDefaultsDidChange:) name:NSUserDefaultsDidChangeNotification object:nil];
-
+
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pauseOrResumeMetricsCollectionIfRequired) name:UIApplicationDidEnterBackgroundNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pauseOrResumeMetricsCollectionIfRequired) name:UIApplicationDidBecomeActiveNotification object:nil];
@@ -256,11 +256,11 @@ const NSTimeInterval MGLFlushInterval = 180;
- (void)pauseOrResumeMetricsCollectionIfRequired {
UIApplication *application = [UIApplication sharedApplication];
-
+
// Prevent blue status bar when host app has `when in use` permission only and it is not in foreground
if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorizedWhenInUse &&
application.applicationState == UIApplicationStateBackground) {
-
+
if (_backgroundTaskIdentifier == UIBackgroundTaskInvalid) {
_backgroundTaskIdentifier = [application beginBackgroundTaskWithExpirationHandler:^{
[application endBackgroundTask:_backgroundTaskIdentifier];
@@ -268,11 +268,11 @@ const NSTimeInterval MGLFlushInterval = 180;
}];
[self flush];
}
-
+
[self pauseMetricsCollection];
return;
}
-
+
// Toggle pause based on current pause state, user opt-out state, and low-power state.
BOOL enabled = [[self class] isEnabled];
if (self.paused && enabled) {
@@ -287,13 +287,13 @@ const NSTimeInterval MGLFlushInterval = 180;
if (self.paused) {
return;
}
-
+
self.paused = YES;
[self.timer invalidate];
self.timer = nil;
[self.eventQueue removeAllObjects];
self.data = nil;
-
+
[self.locationManager stopUpdatingLocation];
}
@@ -304,7 +304,7 @@ const NSTimeInterval MGLFlushInterval = 180;
self.paused = NO;
self.data = [[MGLMapboxEventsData alloc] init];
-
+
[self.locationManager startUpdatingLocation];
}
@@ -316,24 +316,24 @@ const NSTimeInterval MGLFlushInterval = 180;
if ([MGLAccountManager accessToken] == nil) {
return;
}
-
+
if ([self.eventQueue count] <= 1) {
[self.eventQueue removeAllObjects];
[[UIApplication sharedApplication] endBackgroundTask:_backgroundTaskIdentifier];
_backgroundTaskIdentifier = UIBackgroundTaskInvalid;
return;
}
-
+
NSArray *events = [NSArray arrayWithArray:self.eventQueue];
[self.eventQueue removeAllObjects];
-
+
[self postEvents:events];
-
+
if (self.timer) {
[self.timer invalidate];
self.timer = nil;
}
-
+
[self pushDebugEvent:MGLEventTypeLocalDebug withAttributes:@{MGLEventKeyLocalDebugDescription:@"flush"}];
}
@@ -341,21 +341,21 @@ const NSTimeInterval MGLFlushInterval = 180;
if (self.nextTurnstileSendDate && [[NSDate date] timeIntervalSinceDate:self.nextTurnstileSendDate] < 0) {
return;
}
-
+
NSString *vendorID = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
if (!vendorID) {
return;
}
-
+
NSDictionary *turnstileEventAttributes = @{MGLEventKeyEvent: MGLEventTypeAppUserTurnstile,
MGLEventKeyCreated: [self.rfc3339DateFormatter stringFromDate:[NSDate date]],
MGLEventKeyVendorID: vendorID,
MGLEventKeyEnabledTelemetry: @([[self class] isEnabled])};
-
+
if ([MGLAccountManager accessToken] == nil) {
return;
}
-
+
__weak __typeof__(self) weakSelf = self;
[self.apiClient postEvent:turnstileEventAttributes completionHandler:^(NSError * _Nullable error) {
__strong __typeof__(weakSelf) strongSelf = weakSelf;
@@ -375,7 +375,7 @@ const NSTimeInterval MGLFlushInterval = 180;
NSDateComponents *dayComponent = [[NSDateComponents alloc] init];
dayComponent.day = 1;
NSDate *sometimeTomorrow = [calendar dateByAddingComponents:dayComponent toDate:[NSDate date] options:0];
-
+
// Find the start of tomorrow and use that as the next turnstile send date. The effect of this is that
// turnstile events can be sent as much as once per calendar day and always at the start of a session
// when a map load happens.
@@ -392,15 +392,15 @@ const NSTimeInterval MGLFlushInterval = 180;
if (!event) {
return;
}
-
+
if ([event isEqualToString:MGLEventTypeMapLoad]) {
[self pushTurnstileEvent];
}
-
+
if (self.paused) {
return;
}
-
+
MGLMapboxEventAttributes *fullyFormedEvent = [self fullyFormedEventForEvent:event withAttributes:attributeDictionary];
if (fullyFormedEvent) {
[self.eventQueue addObject:fullyFormedEvent];
@@ -497,7 +497,7 @@ const NSTimeInterval MGLFlushInterval = 180;
if (self.paused) {
return;
}
-
+
__weak __typeof__(self) weakSelf = self;
dispatch_async(self.serialQueue, ^{
__strong __typeof__(weakSelf) strongSelf = weakSelf;
@@ -553,7 +553,7 @@ const NSTimeInterval MGLFlushInterval = 180;
result = @"Default - Unknown";
break;
}
-
+
return result;
}
@@ -572,9 +572,9 @@ const NSTimeInterval MGLFlushInterval = 180;
- (NSInteger)contentSizeScale {
NSInteger result = -9999;
-
+
NSString *sc = [UIApplication sharedApplication].preferredContentSizeCategory;
-
+
if ([sc isEqualToString:UIContentSizeCategoryExtraSmall]) {
result = -3;
} else if ([sc isEqualToString:UIContentSizeCategorySmall]) {
@@ -600,7 +600,7 @@ const NSTimeInterval MGLFlushInterval = 180;
} else if ([sc isEqualToString:UIContentSizeCategoryAccessibilityExtraExtraExtraLarge]) {
result = 13;
}
-
+
return result;
}
@@ -675,18 +675,18 @@ const NSTimeInterval MGLFlushInterval = 180;
if (![self debugLoggingEnabled]) {
return;
}
-
+
if (!event) {
return;
}
-
+
MGLMutableMapboxEventAttributes *evt = [MGLMutableMapboxEventAttributes dictionaryWithDictionary:attributeDictionary];
[evt setObject:event forKey:@"event"];
[evt setObject:[self.rfc3339DateFormatter stringFromDate:[NSDate date]] forKey:@"created"];
[evt setValue:[self applicationState] forKey:@"applicationState"];
[evt setValue:@([[self class] isEnabled]) forKey:@"telemetryEnabled"];
[evt setObject:self.instanceID forKey:@"instance"];
-
+
MGLMapboxEventAttributes *finalEvent = [NSDictionary dictionaryWithDictionary:evt];
[self writeEventToLocalDebugLog:finalEvent];
}
@@ -713,12 +713,12 @@ const NSTimeInterval MGLFlushInterval = 180;
dispatch_async(self.debugLogSerialQueue, ^{
if ([NSJSONSerialization isValidJSONObject:event]) {
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:event options:NSJSONWritingPrettyPrinted error:nil];
-
+
NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
jsonString = [jsonString stringByAppendingString:@",\n"];
-
+
NSString *logFilePath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:[NSString stringWithFormat:@"telemetry_log-%@.json", self.dateForDebugLogFile]];
-
+
NSFileManager *fileManager = [[NSFileManager alloc] init];
if ([fileManager fileExistsAtPath:logFilePath]) {
NSFileHandle *fileHandle = [NSFileHandle fileHandleForWritingAtPath:logFilePath];
@@ -780,7 +780,7 @@ const NSTimeInterval MGLFlushInterval = 180;
if (mobileProvision[@"ProvisionedDevices"] && [mobileProvision[@"ProvisionedDevices"] count]) {
return NO; // development or ad-hoc
}
-
+
return YES; // expected development/enterprise/ad-hoc entitlements not found
#endif
}
diff --git a/platform/ios/src/MGLUserLocation.h b/platform/ios/src/MGLUserLocation.h
index 1a27d31dd4..c41c3ee7fd 100644
--- a/platform/ios/src/MGLUserLocation.h
+++ b/platform/ios/src/MGLUserLocation.h
@@ -23,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (nonatomic, readonly, nullable) CLLocation *location;
-/**
+/**
A Boolean value indicating whether the user’s location is currently being
updated. (read-only)
*/
@@ -31,8 +31,8 @@ NS_ASSUME_NONNULL_BEGIN
/**
The heading of the user location. (read-only)
-
- This property is `nil` if the user location tracking mode is not
+
+ This property is `nil` if the user location tracking mode is not
`MGLUserTrackingModeFollowWithHeading`.
*/
@property (nonatomic, readonly, nullable) CLHeading *heading;
diff --git a/platform/ios/src/MGLUserLocation.m b/platform/ios/src/MGLUserLocation.m
index 97e3f740fc..1c9649c09e 100644
--- a/platform/ios/src/MGLUserLocation.m
+++ b/platform/ios/src/MGLUserLocation.m
@@ -48,7 +48,7 @@ NS_ASSUME_NONNULL_END
- (BOOL)isEqual:(id)other {
if (self == other) return YES;
if (![other isKindOfClass:[MGLUserLocation class]]) return NO;
-
+
MGLUserLocation *otherUserLocation = other;
return ((!self.location && !otherUserLocation.location) || [self.location distanceFromLocation:otherUserLocation.location] == 0)
&& ((!self.title && !otherUserLocation.title) || [self.title isEqualToString:otherUserLocation.title])
diff --git a/platform/ios/src/MGLUserLocationAnnotationView.h b/platform/ios/src/MGLUserLocationAnnotationView.h
index bef18e9544..4b36236b8d 100644
--- a/platform/ios/src/MGLUserLocationAnnotationView.h
+++ b/platform/ios/src/MGLUserLocationAnnotationView.h
@@ -13,14 +13,14 @@ NS_ASSUME_NONNULL_BEGIN
/**
Returns the associated map view.
-
+
The value of this property is nil during initialization.
*/
@property (nonatomic, readonly, weak, nullable) MGLMapView *mapView;
-
+
/**
Returns the annotation object indicating the user’s current location.
-
+
The value of this property is nil during initialization and while user tracking
is inactive.
*/
@@ -28,7 +28,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
Returns the layer that should be used for annotation selection hit testing.
-
+
The default value of this property is the presentation layer of the view’s Core
Animation layer. When subclassing, you may override this property to specify a
different layer to be used for hit testing. This can be useful when you wish to
diff --git a/platform/ios/src/MGLUserLocationAnnotationView.m b/platform/ios/src/MGLUserLocationAnnotationView.m
index 3b8d976140..9795565050 100644
--- a/platform/ios/src/MGLUserLocationAnnotationView.m
+++ b/platform/ios/src/MGLUserLocationAnnotationView.m
@@ -22,12 +22,12 @@
{
self = [super initWithFrame:frame];
if (self == nil) return nil;
-
+
self.accessibilityTraits = UIAccessibilityTraitButton | UIAccessibilityTraitAdjustable | UIAccessibilityTraitUpdatesFrequently;
-
+
_accessibilityCoordinateFormatter = [[MGLCoordinateFormatter alloc] init];
_accessibilityCoordinateFormatter.unitStyle = NSFormattingUnitStyleLong;
-
+
return self;
}
@@ -57,13 +57,13 @@
{
return self.userLocation.subtitle;
}
-
+
// Each arcminute of longitude is at most about 1 nmi, too small for low zoom levels.
// Each arcsecond of longitude is at most about 30 m, too small for all but the very highest of zoom levels.
double zoomLevel = self.mapView.zoomLevel;
_accessibilityCoordinateFormatter.allowsMinutes = zoomLevel > 8;
_accessibilityCoordinateFormatter.allowsSeconds = zoomLevel > 20;
-
+
return [_accessibilityCoordinateFormatter stringFromCoordinate:self.mapView.centerCoordinate];
}