调整
This commit is contained in:
@@ -76,6 +76,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.widget.AppCompatButton;
|
||||
import io.flutter.plugin.platform.PlatformView;
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
@@ -204,6 +205,8 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
|
||||
endInput = new TextView(context);
|
||||
endInput.setHint("请输入目的地,不输入则自动匹配推荐加氢站");
|
||||
endInput.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_search, 0, 0, 0);
|
||||
endInput.setCompoundDrawablePadding(dp2px(8));
|
||||
endInput.setTextSize(13);
|
||||
endInput.setTextColor(Color.parseColor("#333333"));
|
||||
endInput.setHintTextColor(Color.GRAY);
|
||||
@@ -248,8 +251,12 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
View vSpace = new View(context);
|
||||
searchArea.addView(vSpace, new LinearLayout.LayoutParams(1, dp2px(12)));
|
||||
|
||||
Button planBtn = new Button(context);
|
||||
AppCompatButton planBtn = new AppCompatButton(context);
|
||||
planBtn.setText("规划路线");
|
||||
planBtn.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_path, 0, 0, 0);
|
||||
planBtn.setCompoundDrawablePadding(dp2px(4));
|
||||
planBtn.setGravity(Gravity.CENTER);
|
||||
planBtn.setPadding(dp2px(8), 0, dp2px(8), 0);
|
||||
planBtn.setTextColor(Color.WHITE);
|
||||
planBtn.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
planBtn.setBackground(getRoundedDrawable(Color.parseColor("#017143"), 99));
|
||||
@@ -377,8 +384,8 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
row1.setOrientation(LinearLayout.HORIZONTAL);
|
||||
row1.setGravity(Gravity.CENTER_VERTICAL);
|
||||
row1.setPadding(0, dp2px(8), 0, 0); // 增加行间距
|
||||
tvDuration = createInfoItem(row1, R.drawable.ic_time, "预计时间:", "", 1.0f);
|
||||
tvTollsFuel = createInfoItem(row1, R.drawable.ic_fuel, "加氢费用:", "", 1.0f);
|
||||
tvDuration = createInfoItem(row1, R.drawable.ic_time, "预计时间:", "-", 1.0f);
|
||||
tvTollsFuel = createInfoItem(row1, R.drawable.ic_fuel, "加氢费用:", "-", 1.0f);
|
||||
routeInfoLayout.addView(row1);
|
||||
|
||||
// 第二行:里程 + 过路费
|
||||
@@ -388,9 +395,9 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
row2.setPadding(0, dp2px(10), 0, 0); // 增加行间距
|
||||
|
||||
// 里程
|
||||
tvDistance = createInfoItem(row2, R.drawable.ic_mileage, "行驶里程:", "", 1.0f);
|
||||
tvDistance = createInfoItem(row2, R.drawable.ic_mileage, "行驶里程:", "-", 1.0f);
|
||||
// 过路费
|
||||
tvTolls = createInfoItem(row2, R.drawable.ic_toll, "过路费:", "", 1.0f);
|
||||
tvTolls = createInfoItem(row2, R.drawable.ic_toll, "过路费:", "-", 1.0f);
|
||||
routeInfoLayout.addView(row2);
|
||||
|
||||
//第三行
|
||||
@@ -398,15 +405,15 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
row3.setOrientation(LinearLayout.HORIZONTAL);
|
||||
row3.setGravity(Gravity.CENTER_VERTICAL);
|
||||
row3.setPadding(0, dp2px(8), 0, 0); // 增加行间距
|
||||
tvPerson = createInfoItem(row3, R.drawable.ic_person, "站联系人:", "", 1.0f);
|
||||
tvPrice = createInfoItem(row3, R.drawable.ic_price, "加氢价格:", "", 1.0f);
|
||||
tvPerson = createInfoItem(row3, R.drawable.ic_person, "站联系人:", "-", 1.0f);
|
||||
tvPrice = createInfoItem(row3, R.drawable.ic_price, "加氢价格:", "-", 1.0f);
|
||||
routeInfoLayout.addView(row3);
|
||||
|
||||
LinearLayout row4 = new LinearLayout(context);
|
||||
row4.setOrientation(LinearLayout.HORIZONTAL);
|
||||
row4.setGravity(Gravity.CENTER_VERTICAL);
|
||||
row4.setPadding(0, dp2px(8), 0, 0); // 增加行间距
|
||||
tvPhone = createInfoItem(row4, R.drawable.ic_phone, "联系方式:", "", 1.0f);
|
||||
tvPhone = createInfoItem(row4, R.drawable.ic_phone, "联系方式:", "-", 1.0f);
|
||||
routeInfoLayout.addView(row4);
|
||||
|
||||
|
||||
@@ -431,6 +438,7 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
searchArea.setVisibility(View.VISIBLE);
|
||||
planToggleBtn.setVisibility(View.VISIBLE);
|
||||
mLocBtn.setVisibility(View.VISIBLE);
|
||||
|
||||
}
|
||||
|
||||
private boolean isGetInputtips = false;
|
||||
@@ -449,6 +457,8 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
//如果是输入地址提示内容
|
||||
|
||||
if (isGetInputtips) {
|
||||
truckRouteData = null;
|
||||
|
||||
RouteSearch.FromAndTo fromAndTo = new RouteSearch.FromAndTo(new LatLonPoint(startPoint.latitude, startPoint.longitude), new LatLonPoint(endPoint.latitude, endPoint.longitude));
|
||||
RouteSearch.DriveRouteQuery query = new RouteSearch.DriveRouteQuery(fromAndTo, RouteSearch.DRIVING_SINGLE_DEFAULT, null, null, "");
|
||||
routeSearch.calculateDriveRouteAsyn(query);
|
||||
@@ -478,6 +488,11 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
String liaisonPhone = "-";
|
||||
String startBusiness = "-";
|
||||
String endBusiness = "-";
|
||||
double distanceKm = 0;
|
||||
String distanceKmStr = "-";
|
||||
long durationMin = 0;
|
||||
String durationMinStr = "-";
|
||||
String tolls = "-";
|
||||
|
||||
if (rCode == AMapException.CODE_AMAP_SUCCESS && result != null && !result.getPaths().isEmpty()) {
|
||||
|
||||
@@ -494,18 +509,20 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
tvStationName.setText(endName);
|
||||
tvStationAddr.setText(endAddress);
|
||||
|
||||
DestinationSite destinationSite = truckRouteData.destinationSite;
|
||||
|
||||
PathDto pathDto = truckRouteData.pathDto;
|
||||
double distanceKm = 0;
|
||||
long durationMin = 0;
|
||||
String tolls = "-";
|
||||
if (pathDto != null) {
|
||||
distanceKm = pathDto.distance / 1000f;
|
||||
durationMin = pathDto.duration / 60;
|
||||
tolls = pathDto.tolls + "元";
|
||||
if (truckRouteData != null) {
|
||||
PathDto pathDto = truckRouteData.pathDto;
|
||||
if (pathDto != null) {
|
||||
distanceKm = pathDto.distance / 1000f;
|
||||
durationMin = pathDto.duration / 60;
|
||||
tolls = pathDto.tolls + "元";
|
||||
|
||||
distanceKmStr = String.format("%.1f", distanceKm) + "公里";
|
||||
durationMinStr = durationMin + "分钟";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 增加多级非空校验,防止点击搜索条目时崩溃
|
||||
if (truckRouteData != null &&
|
||||
truckRouteData.algorithmPath != null &&
|
||||
@@ -515,26 +532,31 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
hydrogenCost = (isGetInputtips ? "--" : hydrogenCost) + "元";
|
||||
}
|
||||
|
||||
tvDuration.setText("预计时间:" + durationMin + "分钟");
|
||||
tvDistance.setText("行驶里程:" + String.format("%.1f", distanceKm) + "公里");
|
||||
tvDuration.setText("预计时间:" + durationMinStr);
|
||||
tvDistance.setText("行驶里程:" + distanceKmStr);
|
||||
tvTolls.setText("过路费:" + tolls);
|
||||
tvTollsFuel.setText("预计加氢费用:" + hydrogenCost);
|
||||
|
||||
if (destinationSite != null) {
|
||||
startBusiness = destinationSite.startBusiness;
|
||||
endBusiness = destinationSite.endBusiness;
|
||||
hydrogenPrice = destinationSite.hydrogenPrice;
|
||||
liaisonName = destinationSite.liaisonName;
|
||||
liaisonPhone = destinationSite.liaisonPhone;
|
||||
|
||||
if (truckRouteData != null) {
|
||||
DestinationSite destinationSite = truckRouteData.destinationSite;
|
||||
if (destinationSite != null) {
|
||||
startBusiness = destinationSite.startBusiness;
|
||||
endBusiness = destinationSite.endBusiness;
|
||||
hydrogenPrice = destinationSite.hydrogenPrice + "/L";
|
||||
liaisonName = destinationSite.liaisonName;
|
||||
liaisonPhone = destinationSite.liaisonPhone;
|
||||
//开始结束时间
|
||||
startBusiness = startBusiness + "-" + endBusiness;
|
||||
}
|
||||
}
|
||||
|
||||
tvBusinessHours.setText("营业时间:" + startBusiness + "-" + endBusiness);
|
||||
String displayValue = "";
|
||||
tvBusinessHours.setText("营业时间:" + startBusiness);
|
||||
if (liaisonName != null && liaisonName.length() > 5) {
|
||||
displayValue = liaisonName.substring(0, 5) + "...";
|
||||
liaisonName = liaisonName.substring(0, 5) + "...";
|
||||
}
|
||||
tvPerson.setText("站联系人:" + displayValue);
|
||||
tvPrice.setText("加氢价格:" + hydrogenPrice + "/L");
|
||||
tvPerson.setText("站联系人:" + liaisonName);
|
||||
tvPrice.setText("加氢价格:" + hydrogenPrice);
|
||||
tvPhone.setText("联系方式:" + liaisonPhone);
|
||||
|
||||
isGetInputtips = false;
|
||||
@@ -634,6 +656,11 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
// 检查途径点数量,决定使用哪种导航方式
|
||||
int wayPointsCount = waysPoiIds.size();
|
||||
Log.d(TAG, "途经点数量: " + wayPointsCount);
|
||||
|
||||
//如果是输入地址提示内容,不判断途经点
|
||||
if (isGetInputtips) {
|
||||
wayPointsCount = 0;
|
||||
}
|
||||
if (wayPointsCount > 3) {
|
||||
// 途经点超过3个,跳转到 NavigationActivity
|
||||
Intent intent = new Intent(mContext, NavigationActivity.class);
|
||||
@@ -826,11 +853,13 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
if (detailPanel != null && detailPanel.getVisibility() == View.VISIBLE) {
|
||||
resetView();
|
||||
}
|
||||
modeMenu.setVisibility(View.GONE);
|
||||
});
|
||||
aMap.setOnPOIClickListener(poi -> {
|
||||
if (detailPanel != null && detailPanel.getVisibility() == View.VISIBLE) {
|
||||
resetView();
|
||||
}
|
||||
modeMenu.setVisibility(View.GONE);
|
||||
});
|
||||
|
||||
MyLocationStyle myLocationStyle = new MyLocationStyle();
|
||||
@@ -1259,7 +1288,6 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
TextView tv = new TextView(mContext);
|
||||
|
||||
|
||||
|
||||
tv.setText(label + value);
|
||||
|
||||
tv.setTextSize(12);
|
||||
@@ -1298,9 +1326,9 @@ public class NativeMapView implements PlatformView, LocationSource, AMapLocation
|
||||
TextView item3 = createMenuItem(context, "加氢规划模式", true);
|
||||
item3.setOnClickListener(v -> switchMode("加氢规划"));
|
||||
|
||||
menu.addView(item1);
|
||||
menu.addView(item2);
|
||||
menu.addView(item3);
|
||||
menu.addView(item2);
|
||||
menu.addView(item1);
|
||||
return menu;
|
||||
}
|
||||
|
||||
|
||||
BIN
ln_jq_app/android/app/src/main/res/drawable/ic_path.png
Normal file
BIN
ln_jq_app/android/app/src/main/res/drawable/ic_path.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 577 B |
BIN
ln_jq_app/android/app/src/main/res/drawable/ic_search.png
Normal file
BIN
ln_jq_app/android/app/src/main/res/drawable/ic_search.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 596 B |
@@ -12,17 +12,17 @@
|
||||
|
||||
#import "AMapNavCommonUtil.h"
|
||||
|
||||
@interface ASearchAddressController ()<UITextFieldDelegate , AMapSearchDelegate,UITableViewDelegate , UITableViewDataSource>
|
||||
@interface ASearchAddressController () <UITextFieldDelegate, AMapSearchDelegate, UITableViewDelegate, UITableViewDataSource>
|
||||
|
||||
@property (nonatomic , strong) UITableView *tableView;
|
||||
@property (nonatomic , strong) UIBarButtonItem *rightItem;
|
||||
@property (nonatomic ,strong)UIButton * backBtn;
|
||||
@property(nonatomic, strong) UITableView *tableView;
|
||||
@property(nonatomic, strong) UIBarButtonItem *rightItem;
|
||||
@property(nonatomic, strong) UIButton *backBtn;
|
||||
|
||||
@property (nonatomic , strong) NSMutableArray *dataArr;
|
||||
@property(nonatomic, strong) NSMutableArray *dataArr;
|
||||
|
||||
@property (nonatomic, strong) UITextField *inputAddressTf;
|
||||
@property (nonatomic, strong) AMapSearchAPI *search;
|
||||
@property (nonatomic,assign)NSInteger currPage;
|
||||
@property(nonatomic, strong) UITextField *inputAddressTf;
|
||||
@property(nonatomic, strong) AMapSearchAPI *search;
|
||||
@property(nonatomic, assign) NSInteger currPage;
|
||||
|
||||
@end
|
||||
|
||||
@@ -34,51 +34,50 @@
|
||||
self.title = @"选择地点";
|
||||
self.currPage = 1;
|
||||
_dataArr = [NSMutableArray array];
|
||||
|
||||
|
||||
|
||||
|
||||
[self initSubview];
|
||||
|
||||
|
||||
self.search = [[AMapSearchAPI alloc] init];
|
||||
self.search.delegate = self;
|
||||
|
||||
|
||||
#ifdef kAMapSDKDebugFlag
|
||||
self.inputAddressTf.text = @"人民广场";
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
[super viewDidAppear:animated];
|
||||
|
||||
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[self.inputAddressTf becomeFirstResponder];
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
-(void)initSubview {
|
||||
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:self.backBtn];
|
||||
|
||||
UITextField * inputAddressTf = [[UITextField alloc] init];
|
||||
- (void)initSubview {
|
||||
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:self.backBtn];
|
||||
|
||||
UITextField *inputAddressTf = [[UITextField alloc] init];
|
||||
inputAddressTf.borderStyle = UITextBorderStyleRoundedRect;
|
||||
inputAddressTf.placeholder = @"输入地址";
|
||||
inputAddressTf.returnKeyType = UIReturnKeySearch;
|
||||
inputAddressTf.tag = 100;
|
||||
inputAddressTf.delegate = self;
|
||||
|
||||
|
||||
[self.view addSubview:inputAddressTf];
|
||||
|
||||
|
||||
[inputAddressTf mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.view).offset(10);
|
||||
make.top.mas_equalTo(self.view).offset(kRoutePlanBarHeight + 10);
|
||||
make.height.mas_equalTo(@30);
|
||||
}];
|
||||
|
||||
|
||||
self.inputAddressTf = inputAddressTf;
|
||||
|
||||
|
||||
|
||||
UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
|
||||
|
||||
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[btn setTitle:@"当前位置" forState:UIControlStateNormal];
|
||||
btn.backgroundColor = [UIColor whiteColor];
|
||||
btn.layer.borderColor = [UIColor blueColor].CGColor;
|
||||
@@ -86,56 +85,69 @@
|
||||
btn.layer.cornerRadius = 5;
|
||||
btn.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
btn.hidden = YES;
|
||||
|
||||
|
||||
[btn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
|
||||
[btn addTarget:self action:@selector(searchBtnAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self.view addSubview:btn];
|
||||
[btn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.equalTo(inputAddressTf.mas_right).offset(12);
|
||||
make.left.equalTo(inputAddressTf.mas_right).offset(12);
|
||||
make.top.mas_equalTo(inputAddressTf);
|
||||
make.right.mas_equalTo(self.view).offset(-10);
|
||||
make.height.mas_equalTo(@30);
|
||||
make.width.mas_equalTo(70);
|
||||
}];
|
||||
|
||||
|
||||
|
||||
|
||||
[self.view addSubview:self.tableView];
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(inputAddressTf.mas_bottom).offset(5);
|
||||
make.left.equalTo(self.view);
|
||||
make.bottom.equalTo(self.view);
|
||||
make.centerX.equalTo(self.view);
|
||||
|
||||
|
||||
}];
|
||||
|
||||
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
|
||||
UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
|
||||
|
||||
- (nonnull UITableViewCell
|
||||
|
||||
*)tableView:(
|
||||
nonnull UITableView
|
||||
*)
|
||||
tableView cellForRowAtIndexPath
|
||||
:(
|
||||
nonnull NSIndexPath
|
||||
*)indexPath {
|
||||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
|
||||
if (!cell) {
|
||||
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell"];
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
}
|
||||
|
||||
AMapPOI * m = self.dataArr[indexPath.row];
|
||||
cell.textLabel.text = [NSString stringWithFormat:@"%@" , m.name ];
|
||||
|
||||
|
||||
AMapPOI *m = self.dataArr[indexPath.row];
|
||||
cell.textLabel.text = [NSString stringWithFormat:@"%@", m.name];
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
- (NSInteger)tableView:(nonnull UITableView
|
||||
|
||||
*)
|
||||
tableView numberOfRowsInSection
|
||||
:(NSInteger)section {
|
||||
return self.dataArr.count;
|
||||
}
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
AMapPOI * m = self.dataArr[indexPath.row];
|
||||
|
||||
AMapPOI *m = self.dataArr[indexPath.row];
|
||||
|
||||
if (self.selectAddressBlk) {
|
||||
self.selectAddressBlk(m);
|
||||
}
|
||||
|
||||
|
||||
[self backBtnAction];
|
||||
// [self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
@@ -145,26 +157,27 @@
|
||||
self.currPage = self.currPage + 1;
|
||||
[self requestAddressWithAddress:self.inputAddressTf.text atPage:self.currPage];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (UITableView *)tableView {
|
||||
if (!_tableView) {
|
||||
_tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
|
||||
_tableView.delegate = self;
|
||||
_tableView.dataSource = self;
|
||||
}
|
||||
|
||||
|
||||
return _tableView;
|
||||
}
|
||||
|
||||
-(UIButton *)backBtn{
|
||||
- (UIButton *)backBtn {
|
||||
if (!_backBtn) {
|
||||
_backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
_backBtn.frame = CGRectMake(0, 0, 40, 30);
|
||||
_backBtn.imageEdgeInsets = UIEdgeInsetsMake(2, -5, 2, 5);
|
||||
|
||||
|
||||
// _backBtn.backgroundColor = UIColor.redColor;
|
||||
[_backBtn setImage:[AMapNavCommonUtil imageWithName:@"icon_fanhui"] forState:UIControlStateNormal];
|
||||
[_backBtn addTarget:self action:@selector(backBtnAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
@@ -172,103 +185,105 @@
|
||||
return _backBtn;
|
||||
}
|
||||
|
||||
-(void)backBtnAction {
|
||||
- (void)backBtnAction {
|
||||
[self dismissViewControllerAnimated:YES completion:^{
|
||||
|
||||
|
||||
}];
|
||||
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - Action
|
||||
-(void)searchBtnAction {
|
||||
AMapNavSDKManager * sdk = [AMapNavSDKManager sharedManager];
|
||||
|
||||
- (void)searchBtnAction {
|
||||
AMapNavSDKManager *sdk = [AMapNavSDKManager sharedManager];
|
||||
self.inputAddressTf.text = sdk.locationAddressDetail;
|
||||
|
||||
|
||||
[self startSearchWithAddress:self.inputAddressTf.text];
|
||||
}
|
||||
|
||||
-(void)startSearchWithAddress:(NSString *)addr {
|
||||
- (void)startSearchWithAddress:(NSString *)addr {
|
||||
if (!addr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
AMapPOIKeywordsSearchRequest *request = [[AMapPOIKeywordsSearchRequest alloc] init];
|
||||
|
||||
request.keywords = addr;
|
||||
|
||||
AMapNavSDKManager * sdk = [AMapNavSDKManager sharedManager];
|
||||
request.city = sdk.localCity;
|
||||
|
||||
|
||||
|
||||
request.keywords = addr;
|
||||
|
||||
AMapNavSDKManager *sdk = [AMapNavSDKManager sharedManager];
|
||||
request.city = sdk.localCity;
|
||||
|
||||
|
||||
// request.types = @"高等院校";
|
||||
// request.requireExtension = YES;
|
||||
request.offset =20;
|
||||
request.offset = 20;
|
||||
request.page = 1;
|
||||
|
||||
|
||||
/* 搜索SDK 3.2.0 中新增加的功能,只搜索本城市的POI。*/
|
||||
request.cityLimit = YES;
|
||||
// request.cityLimit = YES;
|
||||
// request.requireSubPOIs = YES;
|
||||
|
||||
|
||||
|
||||
[self.search AMapPOIKeywordsSearch:request];
|
||||
|
||||
}
|
||||
|
||||
-(void)requestAddressWithAddress:(NSString *)addr atPage:(NSInteger)page {
|
||||
- (void)requestAddressWithAddress:(NSString *)addr atPage:(NSInteger)page {
|
||||
AMapPOIKeywordsSearchRequest *request = [[AMapPOIKeywordsSearchRequest alloc] init];
|
||||
|
||||
request.keywords = addr;
|
||||
|
||||
AMapNavSDKManager * sdk = [AMapNavSDKManager sharedManager];
|
||||
request.city = sdk.localCity;
|
||||
|
||||
|
||||
|
||||
request.keywords = addr;
|
||||
|
||||
AMapNavSDKManager *sdk = [AMapNavSDKManager sharedManager];
|
||||
request.city = sdk.localCity;
|
||||
|
||||
|
||||
// request.types = @"高等院校";
|
||||
// request.requireExtension = YES;
|
||||
request.offset =20;
|
||||
request.offset = 20;
|
||||
request.page = page;
|
||||
|
||||
|
||||
/* 搜索SDK 3.2.0 中新增加的功能,只搜索本城市的POI。*/
|
||||
request.cityLimit = YES;
|
||||
request.cityLimit = YES;
|
||||
// request.requireSubPOIs = YES;
|
||||
|
||||
|
||||
|
||||
[self.search AMapPOIKeywordsSearch:request];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/* POI 搜索回调. */
|
||||
- (void)onPOISearchDone:(AMapPOISearchBaseRequest *)request response:(AMapPOISearchResponse *)response
|
||||
{
|
||||
NSArray * pois = response.pois;
|
||||
if (pois.count == 0)
|
||||
{
|
||||
- (void)onPOISearchDone:(AMapPOISearchBaseRequest *)request response:(AMapPOISearchResponse *)response {
|
||||
NSArray *pois = response.pois;
|
||||
if (pois.count == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
//解析response获取POI信息,具体解析见 Demo
|
||||
|
||||
[self.dataArr addObjectsFromArray:pois];
|
||||
|
||||
[self.tableView reloadData];
|
||||
|
||||
}
|
||||
|
||||
//解析response获取POI信息,具体解析见 Demo
|
||||
|
||||
[self.dataArr addObjectsFromArray:pois];
|
||||
|
||||
[self.tableView reloadData];
|
||||
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
|
||||
[textField resignFirstResponder];
|
||||
[self.dataArr removeAllObjects];
|
||||
self.currPage = 1;
|
||||
|
||||
|
||||
[self startSearchWithAddress:textField.text];
|
||||
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
- (void)touchesBegan:(NSSet
|
||||
|
||||
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
|
||||
<UITouch *> *)
|
||||
touches withEvent
|
||||
:(UIEvent *)event {
|
||||
[self.inputAddressTf resignFirstResponder];
|
||||
}
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user