Commit faa051ac authored by Qiu Xiang's avatar Qiu Xiang

实现 iOS marker 大头针颜色设置接口

parent 87123d6c
......@@ -11,7 +11,7 @@
@class AMapOverlay;
@class AMapInfoWindow;
@interface AMapMarker : MAAnnotationView <MAAnnotation, AMapOverlayDelegate>
@interface AMapMarker : MAPinAnnotationView <MAAnnotation, AMapOverlayDelegate>
@property(nonatomic, assign) CLLocationCoordinate2D coordinate;
@property(nonatomic, copy) NSString *title;
......
......@@ -3,7 +3,7 @@
#pragma ide diagnostic ignored "OCUnusedMethodInspection"
@implementation AMapMarker {
MAAnnotationView *_pinView;
MAPinAnnotationView *_pinView;
AMapOverlay *_iconView;
BOOL _active;
}
......@@ -15,6 +15,10 @@
}
}
- (void)setIcon:(MAPinAnnotationColor)color {
self.pinColor = color;
}
- (void)setDescription:(NSString *)description {
self.subtitle = description;
}
......@@ -27,14 +31,15 @@
if (_pinView == nil) {
_pinView = [[MAPinAnnotationView alloc] initWithAnnotation:self reuseIdentifier: nil];
_pinView.annotation = self;
_pinView.zIndex = self.zIndex;
_pinView.pinColor = self.pinColor;
_pinView.draggable = self.draggable;
_pinView.canShowCallout = self.canShowCallout;
_pinView.customCalloutView = self.customCalloutView;
}
if (_iconView != nil) {
_pinView.image = nil;
}
_pinView.zIndex = self.zIndex;
_pinView.draggable = self.draggable;
_pinView.canShowCallout = self.canShowCallout;
_pinView.customCalloutView = self.customCalloutView;
return _pinView;
}
......
......@@ -25,6 +25,7 @@ RCT_EXPORT_VIEW_PROPERTY(active, BOOL)
RCT_EXPORT_VIEW_PROPERTY(draggable, BOOL)
RCT_EXPORT_VIEW_PROPERTY(infoWindowEnabled, BOOL)
RCT_EXPORT_VIEW_PROPERTY(zIndex, NSInteger)
RCT_EXPORT_VIEW_PROPERTY(icon, MAPinAnnotationColor)
RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
RCT_EXPORT_VIEW_PROPERTY(onInfoWindowPress, RCTBubblingEventBlock)
......
#import <MAMapKit/MAMapKit.h>
#import <React/RCTConvert.h>
@implementation RCTConvert (AMapMarker)
RCT_ENUM_CONVERTER(MAPinAnnotationColor, (@{
@"red": @(MAPinAnnotationColorRed),
@"green": @(MAPinAnnotationColorGreen),
@"purple": @(MAPinAnnotationColorPurple),
}), MAPinAnnotationColorRed, integerValue)
@end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment