Skip to content

Commit 2be13cc

Browse files
authored
Merge pull request #14 from zhangjunhou/master
ios add geocode
2 parents d74c3d7 + 938ec41 commit 2be13cc

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

ios/RCTBaiduMap/BaiduMapModule.m

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,25 @@ @implementation BaiduMapModule {
6666
[[self getBaiduMapView] setZoomLevel:zoom];
6767
}
6868

69+
RCT_EXPORT_METHOD(geocode:(NSString *)city addr:(NSString *)addr) {
70+
71+
[self getGeocodesearch].delegate = self;
72+
73+
BMKGeoCodeSearchOption *geoCodeSearchOption = [[BMKGeoCodeSearchOption alloc]init];
74+
75+
geoCodeSearchOption.city= city;
76+
geoCodeSearchOption.address = addr;
77+
78+
BOOL flag = [[self getGeocodesearch] geoCode:geoCodeSearchOption];
79+
80+
if(flag)
81+
{
82+
NSLog(@"geo检索发送成功");
83+
}else{
84+
NSLog(@"geo检索发送失败");
85+
}
86+
}
87+
6988
RCT_EXPORT_METHOD(reverseGeoCode:(double)lat lng:(double)lng) {
7089

7190
[self getGeocodesearch].delegate = self;
@@ -164,4 +183,4 @@ -(RCTBaiduMapView *) getBaiduMapView {
164183
return [RCTBaiduMapViewManager getBaiduMapView];
165184
}
166185

167-
@end
186+
@end

0 commit comments

Comments
 (0)