Commit a41c45e1 authored by Qiu Xiang's avatar Qiu Xiang

实现 iOS 中心坐标设置接口

parent 412c14d2
......@@ -11,4 +11,8 @@
[super setRotateCameraEnabled:enabled];
}
- (void)setCoordinate:(CLLocationCoordinate2D)json {
super.centerCoordinate = json;
}
@end
......@@ -2,19 +2,10 @@
#import <React/RCTViewManager.h>
#import "AMapView.h"
#pragma ide diagnostic ignored "OCUnusedClassInspection"
@interface AMapViewManager : RCTViewManager
@end
@implementation RCTConvert (AMapView)
RCT_ENUM_CONVERTER(MAMapType, (@{
@"standard": @(MAMapTypeStandard),
@"satellite": @(MAMapTypeSatellite),
@"navigation": @(MAMapTypeNavi),
@"night": @(MAMapTypeStandardNight),
@"bus": @(MAMapTypeBus),
}), MAMapTypeStandard, integerValue)
@end
@implementation AMapViewManager {
AMapView *mapView;
}
......@@ -56,4 +47,6 @@ RCT_EXPORT_VIEW_PROPERTY(tiltEnabled, BOOL)
RCT_EXPORT_VIEW_PROPERTY(mapType, MAMapType)
RCT_EXPORT_VIEW_PROPERTY(coordinate, CLLocationCoordinate2D)
@end
#import <MAMapKit/MAMapView.h>
#import <React/RCTConvert.h>
@interface RCTConvert (AMapView)
+ (CLLocationCoordinate2D)CLLocationCoordinate2D:(id)json;
@end
\ No newline at end of file
#import "RCTConvert+AMapView.h"
@implementation RCTConvert (AMapView)
RCT_ENUM_CONVERTER(MAMapType, (@{
@"standard": @(MAMapTypeStandard),
@"satellite": @(MAMapTypeSatellite),
@"navigation": @(MAMapTypeNavi),
@"night": @(MAMapTypeStandardNight),
@"bus": @(MAMapTypeBus),
}), MAMapTypeStandard, integerValue)
RCT_CONVERTER(CLLocationDegrees, CLLocationDegrees, doubleValue);
RCT_CONVERTER(CLLocationDistance, CLLocationDistance, doubleValue);
+ (CLLocationCoordinate2D)CLLocationCoordinate2D:(id)json {
return CLLocationCoordinate2DMake(
[self CLLocationDegrees:json[@"latitude"]],
[self CLLocationDegrees:json[@"longitude"]]);
}
@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