mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-15 18:59:54 +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;
|
||||
|
||||
/**
|
||||
* @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.
|
||||
* @param annotations An array of objects that conform to the MKAnnotation protocol
|
||||
* @abstract The annotations to display on the map.
|
||||
*/
|
||||
- (void)setAnnotations:(NSArray<id<MKAnnotation>> *)annotations;
|
||||
@property (nonatomic, copy) NSArray<id<MKAnnotation>> *annotations;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@ -43,6 +43,7 @@
|
||||
_needsMapReloadOnBoundsChange = YES;
|
||||
_liveMap = NO;
|
||||
_centerCoordinateOfMap = kCLLocationCoordinate2DInvalid;
|
||||
_annotations = @[];
|
||||
return self;
|
||||
}
|
||||
|
||||
@ -251,10 +252,18 @@
|
||||
_mapView = nil;
|
||||
}
|
||||
|
||||
- (void)setAnnotations:(NSArray *)annotations
|
||||
- (NSArray *)annotations
|
||||
{
|
||||
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) {
|
||||
[_mapView removeAnnotations:_mapView.annotations];
|
||||
[_mapView addAnnotations:annotations];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user