mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 19:30:29 +00:00
Merge pull request #1274 from Adlai-Holler/AHMapNodeVendAnnotations
[ASMapNode] Promote annotations to a Formal Property
This commit is contained in:
commit
6e85ad8170
@ -48,10 +48,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@property (nonatomic, weak) id <MKMapViewDelegate> mapDelegate;
|
@property (nonatomic, weak) id <MKMapViewDelegate> mapDelegate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @discussion This method sets the annotations of the static map view and also to the live map view. Passing an empty array clears the map of any annotations.
|
* @abstract The annotations to display on the map.
|
||||||
* @param annotations An array of objects that conform to the MKAnnotation protocol
|
|
||||||
*/
|
*/
|
||||||
- (void)setAnnotations:(NSArray<id<MKAnnotation>> *)annotations;
|
@property (nonatomic, copy) NSArray<id<MKAnnotation>> *annotations;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|||||||
@ -43,6 +43,7 @@
|
|||||||
_needsMapReloadOnBoundsChange = YES;
|
_needsMapReloadOnBoundsChange = YES;
|
||||||
_liveMap = NO;
|
_liveMap = NO;
|
||||||
_centerCoordinateOfMap = kCLLocationCoordinate2DInvalid;
|
_centerCoordinateOfMap = kCLLocationCoordinate2DInvalid;
|
||||||
|
_annotations = @[];
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,10 +252,18 @@
|
|||||||
_mapView = nil;
|
_mapView = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setAnnotations:(NSArray *)annotations
|
- (NSArray *)annotations
|
||||||
{
|
{
|
||||||
ASDN::MutexLocker l(_propertyLock);
|
ASDN::MutexLocker l(_propertyLock);
|
||||||
_annotations = [annotations copy];
|
return _annotations;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)setAnnotations:(NSArray *)annotations
|
||||||
|
{
|
||||||
|
annotations = [annotations copy] ?: @[];
|
||||||
|
|
||||||
|
ASDN::MutexLocker l(_propertyLock);
|
||||||
|
_annotations = annotations;
|
||||||
if (self.isLiveMap) {
|
if (self.isLiveMap) {
|
||||||
[_mapView removeAnnotations:_mapView.annotations];
|
[_mapView removeAnnotations:_mapView.annotations];
|
||||||
[_mapView addAnnotations:annotations];
|
[_mapView addAnnotations:annotations];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user