Skip to content

Commit

Permalink
Update method getCurrentPosition for IOS
Browse files Browse the repository at this point in the history
  • Loading branch information
lovebing committed Aug 15, 2016
1 parent 20b57f7 commit 887a82e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Binary file not shown.
16 changes: 12 additions & 4 deletions ios/RCTBaiduMap/BaiduMapModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

#import "BaiduMapModule.h"

@implementation BaiduMapModule
@implementation BaiduMapModule {
BMKPointAnnotation* _annotation;
}

@synthesize bridge = _bridge;

Expand All @@ -19,12 +21,18 @@ @implementation BaiduMapModule
RCT_EXPORT_MODULE();

RCT_EXPORT_METHOD(setMarker:(double)lat lng:(double)lng) {
BMKPointAnnotation* annotation = [[BMKPointAnnotation alloc]init];
if(_annotation == nil) {
_annotation = [[BMKPointAnnotation alloc]init];
}
else {
[[self getBaiduMapView] removeAnnotation:_annotation];
}

CLLocationCoordinate2D coor;
coor.latitude = lat;
coor.longitude = lng;
annotation.coordinate = coor;
[[self getBaiduMapView] addAnnotation:annotation];
_annotation.coordinate = coor;
[[self getBaiduMapView] addAnnotation:_annotation];
}

RCT_EXPORT_METHOD(setMapType:(int)type) {
Expand Down

0 comments on commit 887a82e

Please sign in to comment.