fix:优化完善;

This commit is contained in:
xiaogg
2026-04-13 16:13:23 +08:00
parent 08dcc64ef4
commit 5c74c7ccc0
26 changed files with 1673 additions and 54 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 844 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 792 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 909 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 864 B

View File

@@ -0,0 +1,30 @@
//
// AAddHPopView.h
// AMapNavIOSSDK
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/**
* 气泡弹框视图
*
* 用法:
* AAddHPopView *pop = [[AAddHPopView alloc] init];
* [pop showInView:self.view sourceView:addHbtn];
*
* - 点击气泡外部自动消失
* - 箭头在右下角45度指向 sourceView 中心
*/
@interface AAddHPopView : UIView
/// 展示气泡sourceView 为箭头指向的锚定按钮(坐标系属于 view
- (void)showInView:(UIView *)view sourceView:(UIView *)sourceView;
/// 手动消失(点击空白处会自动调用)
- (void)dismiss;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,359 @@
//
// AAddHPopView.m
// AMapNavIOSSDK
//
#import "AAddHPopView.h"
#import <Masonry/Masonry.h>
#import "UIColor+ANavMap.h"
//
static const CGFloat kBubbleWidth = 200.f; //
static const CGFloat kHeaderHeight = 50.f; // 绿
static const CGFloat kOptionHeight = 60.f; //
static const CGFloat kArrowWidth = 50.f; // aw = ah*2 使45
static const CGFloat kArrowHeight = 15.f; //
static const CGFloat kBubbleRadius = 15.f; //
static const CGFloat kBubbleGap = 5.f; // sourceView
static const CGFloat kScreenPadding = 15.f; //
// +
@interface _ABubbleContainerView : UIView
/// X view showInView
@property (nonatomic, assign) CGFloat arrowCenterX;
@end
@implementation _ABubbleContainerView
- (instancetype)init {
self = [super init];
if (self) {
self.backgroundColor = [UIColor clearColor];
_arrowCenterX = kBubbleWidth / 2.f;
}
return self;
}
- (void)setArrowCenterX:(CGFloat)arrowCenterX {
_arrowCenterX = arrowCenterX;
[self setNeedsDisplay];
}
- (void)drawRect:(CGRect)rect {
CGFloat bw = kBubbleWidth; // 160
CGFloat bh = kHeaderHeight + kOptionHeight * 2.f; // 150
CGFloat r = kBubbleRadius; // 10
CGFloat aw = kArrowWidth; // 16
CGFloat ah = kArrowHeight; // 10
// 45
// : (arrowX-aw/2, bh) (arrowX, bh)
// : (arrowX + ah, bh + ah) 45
CGFloat arrowX = bw - 15.f; // X
CGFloat arrowTipX = arrowX + ah; // Xah = 45
CGFloat arrowTipY = bh + ah; // Yah = 45
UIBezierPath *path = [UIBezierPath bezierPath];
//
[path moveToPoint:CGPointMake(r, 0)];
[path addLineToPoint:CGPointMake(bw - r, 0)];
[path addArcWithCenter:CGPointMake(bw - r, r) radius:r
startAngle:-M_PI_2 endAngle:0 clockwise:YES];
//
[path addLineToPoint:CGPointMake(bw, bh - r)];
[path addArcWithCenter:CGPointMake(bw - r, bh - r) radius:r
startAngle:0 endAngle:M_PI_2 clockwise:YES];
//
[path addLineToPoint:CGPointMake(arrowX, bh)];
// 45
[path addLineToPoint:CGPointMake(arrowTipX, arrowTipY)];
//
[path addLineToPoint:CGPointMake(arrowX - ah, bh)];
//
[path addArcWithCenter:CGPointMake(r, bh - r) radius:r
startAngle:M_PI_2 endAngle:M_PI clockwise:YES];
//
[path addLineToPoint:CGPointMake(0, r)];
[path addArcWithCenter:CGPointMake(r, r) radius:r
startAngle:M_PI endAngle:-M_PI_2 clockwise:YES];
[path closePath];
// +
CGContextRef ctx = UIGraphicsGetCurrentContext();
CGContextSaveGState(ctx);
CGContextSetShadowWithColor(ctx, CGSizeMake(0, 3), 10.f,
[[UIColor blackColor] colorWithAlphaComponent:0.15f].CGColor);
[[UIColor whiteColor] setFill];
[path fill];
CGContextRestoreGState(ctx);
[[UIColor whiteColor] setFill];
[path fill];
//
_arrowTipX = arrowTipX;
_arrowTipY = arrowTipY;
}
// 访
static CGFloat _arrowTipX = 0;
static CGFloat _arrowTipY = 0;
@end
// AAddHPopView
@interface AAddHPopView ()
@property (nonatomic, strong) _ABubbleContainerView *bubbleContainer;
@property (nonatomic, strong) UIView *headerView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UIView *separatorLine1;
@property (nonatomic, strong) UILabel *option1Label;
@property (nonatomic, strong) UIView *separatorLine2;
@property (nonatomic, strong) UILabel *option2Label;
@end
@implementation AAddHPopView
#pragma mark - Init
- (instancetype)init {
return [self initWithFrame:CGRectZero];
}
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self p_setupUI];
}
return self;
}
#pragma mark - Setup UI
- (void)p_setupUI {
self.backgroundColor = [UIColor clearColor];
// self
UITapGestureRecognizer *bgTap = [[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(dismiss)];
bgTap.cancelsTouchesInView = NO;
[self addGestureRecognizer:bgTap];
//
[self addSubview:self.bubbleContainer];
// header绿
[self.bubbleContainer addSubview:self.headerView];
[self.headerView addSubview:self.titleLabel];
// 线 1
[self.bubbleContainer addSubview:self.separatorLine1];
// 1
[self.bubbleContainer addSubview:self.option1Label];
// 线 2
[self.bubbleContainer addSubview:self.separatorLine2];
// 2
[self.bubbleContainer addSubview:self.option2Label];
// bgTap
UITapGestureRecognizer *bubbleTap = [[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(p_bubbleTapped)];
[self.bubbleContainer addGestureRecognizer:bubbleTap];
// Masonry bubbleContainer
// kBubbleWidth160
[self.headerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.left.equalTo(self.bubbleContainer);
make.width.mas_equalTo(kBubbleWidth);
make.height.mas_equalTo(kHeaderHeight);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.headerView);
}];
[self.separatorLine1 mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.headerView.mas_bottom);
make.left.mas_equalTo(@0);
make.width.mas_equalTo(kBubbleWidth);
make.height.mas_equalTo(0.5);
}];
[self.option1Label mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.separatorLine1.mas_bottom);
make.left.mas_equalTo(@0);
make.width.mas_equalTo(kBubbleWidth);
make.height.mas_equalTo(kOptionHeight);
}];
[self.separatorLine2 mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.option1Label.mas_bottom);
make.left.mas_equalTo(@0);
make.width.mas_equalTo(kBubbleWidth);
make.height.mas_equalTo(0.5);
}];
[self.option2Label mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.separatorLine2.mas_bottom);
make.left.mas_equalTo(@0);
make.width.mas_equalTo(kBubbleWidth);
make.height.mas_equalTo(kOptionHeight);
}];
}
#pragma mark - Show / Dismiss
- (void)showInView:(UIView *)view sourceView:(UIView *)sourceView {
self.frame = view.bounds;
[view addSubview:self];
// sourceView view frame
CGRect srcFrame = [sourceView convertRect:sourceView.bounds toView:view];
//
CGFloat containerW = kBubbleWidth; // 160
CGFloat containerH = kHeaderHeight + kOptionHeight * 2.f; // 150
CGFloat ah = kArrowHeight; // 16
// bubbleContainer
// drawRect arrowX = bw - 35, arrowTipX = arrowX + ah
CGFloat arrowX_inContainer = containerW - 25.f; // X
CGFloat arrowTipX_inContainer = arrowX_inContainer + ah; // X45
CGFloat arrowTipY_inContainer = containerH + ah; // Y
//
CGFloat srcCenterX = CGRectGetMidX(srcFrame);
CGFloat srcCenterY = CGRectGetMidY(srcFrame);
//
CGFloat containerX = srcCenterX - arrowTipX_inContainer;
containerX = MAX(kScreenPadding, MIN(containerX, view.bounds.size.width - containerW - kScreenPadding));
//
CGFloat containerY = srcCenterY - arrowTipY_inContainer;
containerY = MAX(kScreenPadding, containerY);
self.bubbleContainer.bounds = CGRectMake(0, 0, containerW, containerH + ah);
//
self.bubbleContainer.layer.anchorPoint = CGPointMake(arrowTipX_inContainer / containerW,
arrowTipY_inContainer / (containerH + ah));
self.bubbleContainer.center = CGPointMake(srcCenterX - 25, srcCenterY - 20);
//
self.alpha = 0.f;
self.bubbleContainer.transform = CGAffineTransformMakeScale(0.85f, 0.85f);
[UIView animateWithDuration:0.25f
delay:0.f
usingSpringWithDamping:0.72f
initialSpringVelocity:0.3f
options:UIViewAnimationOptionCurveEaseOut
animations:^{
self.alpha = 1.f;
self.bubbleContainer.transform = CGAffineTransformIdentity;
} completion:nil];
}
- (void)dismiss {
[UIView animateWithDuration:0.18f
delay:0.f
options:UIViewAnimationOptionCurveEaseIn
animations:^{
self.alpha = 0.f;
self.bubbleContainer.transform = CGAffineTransformMakeScale(0.85f, 0.85f);
} completion:^(BOOL finished) {
[self removeFromSuperview];
}];
}
#pragma mark - Private Actions
- (void)p_bubbleTapped {
//
}
#pragma mark - Lazy Load
- (_ABubbleContainerView *)bubbleContainer {
if (!_bubbleContainer) {
_bubbleContainer = [[_ABubbleContainerView alloc] init];
}
return _bubbleContainer;
}
- (UIView *)headerView {
if (!_headerView) {
_headerView = [[UIView alloc] init];
_headerView.backgroundColor = [UIColor hp_colorWithRGBHex:0x1BA855];
if (@available(iOS 11.0, *)) {
_headerView.layer.cornerRadius = kBubbleRadius;
_headerView.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner;
_headerView.clipsToBounds = YES;
}
}
return _headerView;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.text = @"加氢规划模式";
_titleLabel.textColor = [UIColor whiteColor];
_titleLabel.font = [UIFont boldSystemFontOfSize:15.f];
_titleLabel.textAlignment = NSTextAlignmentCenter;
}
return _titleLabel;
}
- (UIView *)separatorLine1 {
if (!_separatorLine1) {
_separatorLine1 = [[UIView alloc] init];
_separatorLine1.backgroundColor = [UIColor colorWithWhite:0.88f alpha:1.f];
}
return _separatorLine1;
}
- (UILabel *)option1Label {
if (!_option1Label) {
_option1Label = [[UILabel alloc] init];
_option1Label.text = @"送货规划模式";
_option1Label.textColor = [UIColor hp_colorWithRGBHex:0xC9CDD4];
_option1Label.font = [UIFont boldSystemFontOfSize:14.f];
_option1Label.textAlignment = NSTextAlignmentCenter;
}
return _option1Label;
}
- (UIView *)separatorLine2 {
if (!_separatorLine2) {
_separatorLine2 = [[UIView alloc] init];
_separatorLine2.backgroundColor = [UIColor colorWithWhite:0.88f alpha:1.f];
}
return _separatorLine2;
}
- (UILabel *)option2Label {
if (!_option2Label) {
_option2Label = [[UILabel alloc] init];
_option2Label.text = @"成本计算模式";
_option2Label.textColor = [UIColor hp_colorWithRGBHex:0xC9CDD4];
_option2Label.font = [UIFont boldSystemFontOfSize:14.f];
_option2Label.textAlignment = NSTextAlignmentCenter;
}
return _option2Label;
}
@end

View File

@@ -0,0 +1,16 @@
//
// ACustomNaviDriveController.h
// AMapNavIOSSDK
//
// Created by admin on 2026/4/11.
//
#import "ABaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface ACustomNaviDriveController : ABaseViewController
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,22 @@
//
// ACustomNaviDriveController.m
// AMapNavIOSSDK
//
// Created by admin on 2026/4/11.
//
#import "ACustomNaviDriveController.h"
@interface ACustomNaviDriveController ()
@end
@implementation ACustomNaviDriveController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
@end

View File

@@ -21,8 +21,8 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface ARoutePlaneController : ABaseViewController @interface ARoutePlaneController : ABaseViewController<AMapNaviDriveDataRepresentable>
@property (nonatomic , strong) AMapNaviDriveView * driveView;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -18,7 +18,7 @@
#import "AMapPrivacyUtility.h" #import "AMapPrivacyUtility.h"
#import "AStationDetailPopupController.h" #import "AStationDetailPopupView.h"
#define kRouteIndicatorViewHeight 64.f #define kRouteIndicatorViewHeight 64.f
@@ -26,8 +26,9 @@
#import "AMapNavHttpUtil.h" #import "AMapNavHttpUtil.h"
#import "ACustomStepView.h" #import "ACustomStepView.h"
#import "ABottomBarView.h" #import "ABottomBarView.h"
#import "AAddHPopView.h"
@interface ARoutePlaneController ()<MAMapViewDelegate, AMapNaviDriveManagerDelegate,AMapNaviCompositeManagerDelegate , AMapLocationManagerDelegate , UITextFieldDelegate , AStationDetailPopupDelegate, ABottomBarViewDelegate> @interface ARoutePlaneController ()<MAMapViewDelegate, AMapNaviDriveManagerDelegate,AMapNaviCompositeManagerDelegate , AMapLocationManagerDelegate , UITextFieldDelegate , AStationDetailPopupViewDelegate, ABottomBarViewDelegate>
@property (nonatomic, strong) UITextField *textField; @property (nonatomic, strong) UITextField *textField;
/// +线 /// +线
@@ -65,11 +66,14 @@
@property (nonatomic , strong)ACustomStepView * stepView; @property (nonatomic , strong)ACustomStepView * stepView;
/// ///
@property (nonatomic , strong)AStationDetailPopupController * stationDetailPopup; @property (nonatomic , strong)AStationDetailPopupView * stationDetailPopup;
@property (nonatomic, strong) ANavPointModel *pointModel; // @property (nonatomic, strong) ANavPointModel *pointModel; //
@property (nonatomic, strong) ATripCalcDataModel * tjdPathInfoModel;// @property (nonatomic, strong) ATripCalcDataModel * tjdPathInfoModel;//
@property (nonatomic, strong) CLLocationManager * locationManager; @property (nonatomic, strong) CLLocationManager * locationManager;
///
@property (nonatomic, weak) UIButton *addHBtn;
@end @end
@implementation ARoutePlaneController @implementation ARoutePlaneController
@@ -156,6 +160,8 @@
-(void)requestRoutePathWithParms:(NSDictionary*)dic completeHandle:(void(^)(ATripCalcDataModel * tjd))blk { -(void)requestRoutePathWithParms:(NSDictionary*)dic completeHandle:(void(^)(ATripCalcDataModel * tjd))blk {
///
self.tjdPathInfoModel = nil;
NSString * token = [[NSUserDefaults standardUserDefaults]valueForKey:@"flutter.token"]; NSString * token = [[NSUserDefaults standardUserDefaults]valueForKey:@"flutter.token"];
NSString * carNo = [[NSUserDefaults standardUserDefaults]valueForKey:@"flutter.plateNumber"]; NSString * carNo = [[NSUserDefaults standardUserDefaults]valueForKey:@"flutter.plateNumber"];
@@ -279,7 +285,7 @@
[bottomBar mas_makeConstraints:^(MASConstraintMaker *make) { [bottomBar mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view); make.left.right.equalTo(self.view);
make.bottom.equalTo(self.view); make.bottom.equalTo(self.view).offset(-AMP_TabbarHeight - 10);
}]; }];
// startTf / dstTf // startTf / dstTf
@@ -319,25 +325,55 @@
[stepView addObserver:self forKeyPath:@"value" options:NSKeyValueObservingOptionNew context:nil]; [stepView addObserver:self forKeyPath:@"value" options:NSKeyValueObservingOptionNew context:nil];
self.stepView = stepView; self.stepView = stepView;
stepView.hidden = YES;
/// ///
UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom]; UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
[btn setImage:[AMapNavCommonUtil imageWithName3x:@"my_location_icon"] forState:UIControlStateNormal]; [btn setBackgroundImage:[AMapNavCommonUtil imageWithName3x:@"my_location_icon"] forState:UIControlStateNormal];
btn.backgroundColor = [UIColor lightGrayColor];
btn.backgroundColor = [UIColor whiteColor];
btn.titleLabel.font = [UIFont systemFontOfSize:14]; btn.titleLabel.font = [UIFont systemFontOfSize:14];
btn.layer.cornerRadius = 20; btn.layer.cornerRadius = 22;
[btn addTarget:self action:@selector(updateUserLocalAction) forControlEvents:UIControlEventTouchUpInside]; [btn addTarget:self action:@selector(updateUserLocalAction) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:btn]; [self.view addSubview:btn];
[btn mas_makeConstraints:^(MASConstraintMaker *make) { [btn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.view).offset(-10); make.right.equalTo(self.view).offset(-10);
make.width.height.equalTo(@40); make.width.height.equalTo(@44);
make.bottom.equalTo(bottomBar.mas_top).offset(-85); make.bottom.equalTo(bottomBar.mas_top).offset(-105);
}]; }];
///
UIButton *addHbtn = [UIButton buttonWithType:UIButtonTypeCustom];
addHbtn.backgroundColor = [UIColor hp_colorWithRGBHex:0x017137];
addHbtn.titleLabel.numberOfLines = 2;
[addHbtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[addHbtn setTitle:@"加氢规划" forState:UIControlStateNormal];
addHbtn.titleLabel.font = [UIFont boldSystemFontOfSize:11];
addHbtn.titleEdgeInsets = UIEdgeInsetsMake(0, 3, 0, 3);
addHbtn.layer.cornerRadius = 22;
[addHbtn addTarget:self action:@selector(addHbtnAction:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:addHbtn];
[addHbtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.view).offset(-10);
make.width.height.equalTo(@44);
make.bottom.equalTo(btn.mas_top).offset(-25);
}];
self.addHBtn = addHbtn;
} }
- (void)addHbtnAction:(UIButton *)sender {
//
AAddHPopView *popView = [[AAddHPopView alloc] init];
[popView showInView:self.view sourceView:sender];
}
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context { - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {
if ([keyPath isEqualToString:@"value"]) { if ([keyPath isEqualToString:@"value"]) {
self.mapView.zoomLevel = [change[NSKeyValueChangeNewKey] doubleValue]; self.mapView.zoomLevel = [change[NSKeyValueChangeNewKey] doubleValue];
@@ -363,6 +399,7 @@
self.mapView.userTrackingMode = MAUserTrackingModeFollowWithHeading; self.mapView.userTrackingMode = MAUserTrackingModeFollowWithHeading;
self.mapView.desiredAccuracy = kCLLocationAccuracyNearestTenMeters; // self.mapView.desiredAccuracy = kCLLocationAccuracyNearestTenMeters; //
_mapView.showsScale= YES; _mapView.showsScale= YES;
_mapView.showsCompass = NO;
_mapView.logoCenter = CGPointMake(CGRectGetWidth(self.view.bounds)-55, 450); _mapView.logoCenter = CGPointMake(CGRectGetWidth(self.view.bounds)-55, 450);
self.mapView.zoomLevel = 11; self.mapView.zoomLevel = 11;
@@ -508,7 +545,7 @@
0, 0,
0, 0,
0); 0);
strategy = AMapNaviDrivingStrategyMultipleDefault;//使 strategy = AMapNaviDrivingStrategyMultipleDefault;//使DRIVING_MULTIPLE_ROUTES_DEFAULT
id delegate = [AMapNaviDriveManager sharedInstance].delegate; id delegate = [AMapNaviDriveManager sharedInstance].delegate;
if (!delegate) { if (!delegate) {
@@ -780,6 +817,7 @@
[config setNeedCalculateRouteWhenPresent:NO];// [config setNeedCalculateRouteWhenPresent:NO];//
[config setMultipleRouteNaviMode:NO];//线 [config setMultipleRouteNaviMode:NO];//线
// [config setNeedDestoryDriveManagerInstanceWhenDismiss:NO]; // [config setNeedDestoryDriveManagerInstanceWhenDismiss:NO];
[config setShowDrivingStrategyPreferenceView:NO];
[self.compositeManager presentRoutePlanViewControllerWithOptions:config]; [self.compositeManager presentRoutePlanViewControllerWithOptions:config];
} }
@@ -797,6 +835,8 @@
// [config setMultipleRouteNaviMode:NO];//线 // [config setMultipleRouteNaviMode:NO];//线
// [config setNeedDestoryDriveManagerInstanceWhenDismiss:NO]; // [config setNeedDestoryDriveManagerInstanceWhenDismiss:NO];
// [config setShowDrivingStrategyPreferenceView:NO];
[self.compositeManager presentRoutePlanViewControllerWithOptions:config]; [self.compositeManager presentRoutePlanViewControllerWithOptions:config];
} }
@@ -995,9 +1035,12 @@
[self updateUIWithData:aoi textField:self.dstTf]; [self updateUIWithData:aoi textField:self.dstTf];
///
//
[self willRequestTJDInfo];
// //
self.bottomBarView.destinationText = aoi.name; // self.bottomBarView.destinationText = aoi.name;
} }
} }
@@ -1056,6 +1099,7 @@
AMapPOI *_dstPoi = self.dstPoi ? self.dstPoi : self.defaultDstPoi; AMapPOI *_dstPoi = self.dstPoi ? self.dstPoi : self.defaultDstPoi;
if (!_dstPoi) { if (!_dstPoi) {
[AMapNavCommonUtil showMsg:@"请先选择目的地"];
return; return;
} }
@@ -1066,9 +1110,19 @@
navPoint.stationID = _dstPoi.uid; navPoint.stationID = _dstPoi.uid;
self.pointModel = navPoint; self.pointModel = navPoint;
if (self.stationDetailPopup) {
[self.stationDetailPopup resetUI];
}
///_stationID 线 ///_stationID 线
if (!navPoint.stationID) { if (!navPoint.stationID) {
[self gd_calPathWithNoStationId:navPoint]; // [self gd_calPathWithNoStationId:navPoint];
ANavPointModel * model = [ANavPointModel new];
model.name = navPoint.name;
model.address = navPoint.address;
[self showDstInfoPop:model];
return; return;
}else { }else {
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
@@ -1084,7 +1138,7 @@
// --- --- // --- ---
if (!self.stationDetailPopup) { if (!self.stationDetailPopup) {
AStationDetailPopupController *popup = [[AStationDetailPopupController alloc] init]; AStationDetailPopupView *popup = [[AStationDetailPopupView alloc] init];
popup.delegate = self; popup.delegate = self;
self.stationDetailPopup = popup; self.stationDetailPopup = popup;
} }
@@ -1101,13 +1155,25 @@
/// ///
self.stationDetailPopup.tollFee = self.tjdPathInfoModel.pathDto.tolls; self.stationDetailPopup.tollFee = self.tjdPathInfoModel.pathDto.tolls;
[self.stationDetailPopup presentInViewController:self]; ///
self.stationDetailPopup.contactName = self.tjdPathInfoModel.destinationSite.liaisonName;
self.stationDetailPopup.contactPhone = self.tjdPathInfoModel.destinationSite.liaisonPhone;
self.stationDetailPopup.businessHours = [NSString stringWithFormat:@"%@-%@" , [AMapNavCommonUtil stringValueFromStr:self.tjdPathInfoModel.destinationSite.startBusiness] , [AMapNavCommonUtil stringValueFromStr:self.tjdPathInfoModel.destinationSite.endBusiness]];
self.stationDetailPopup.hydrogenPrice = [AMapNavCommonUtil stringValueFromStr:self.tjdPathInfoModel.destinationSite.hydrogenPrice];
[self.stationDetailPopup showInView:self.view];
// [self addChildViewController:self.stationDetailPopup];
//
// CGRect rect = CGRectMake(CGRectGetMinX(self.view.frame), CGRectGetMinY(self.view.frame), CGRectGetWidth(self.view.frame), CGRectGetHeight(self.view.frame) - (AMP_TabbarHeight + 20) * 2);
// self.stationDetailPopup.view.frame = rect;
//
// [self.view addSubview:self.stationDetailPopup.view];
} }
#pragma mark - AStationDetailPopupDelegate #pragma mark - AStationDetailPopupViewDelegate
- (void)stationDetailPopupDidTapStartNavi:(AStationDetailPopupController *)popup { - (void)stationDetailPopupViewDidTapStartNavi:(AStationDetailPopupView *)popup {
self.stationDetailPopup = nil; self.stationDetailPopup = nil;
/// ///
///1线 ///1线
@@ -1126,7 +1192,7 @@
} }
} }
- (void)stationDetailPopupDidTapClose:(AStationDetailPopupController *)popup { - (void)stationDetailPopupViewDidTapClose:(AStationDetailPopupView *)popup {
self.stationDetailPopup = nil; self.stationDetailPopup = nil;
} }
@@ -1140,6 +1206,9 @@
} }
- (void)bottomBarViewDidTapSearchField:(ABottomBarView *)barView { - (void)bottomBarViewDidTapSearchField:(ABottomBarView *)barView {
///
self.tjdPathInfoModel = nil;
// //
ASearchAddressController *vc = [[ASearchAddressController alloc] init]; ASearchAddressController *vc = [[ASearchAddressController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc]; UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
@@ -1160,7 +1229,8 @@
-(void)updateUIWithData: (AMapPOI*)poi textField: (UITextField*)tf { -(void)updateUIWithData: (AMapPOI*)poi textField: (UITextField*)tf {
BOOL isStart = tf.tag == 100; BOOL isStart = tf.tag == 100;
tf.text = poi.name; ///
// tf.text = poi.name;
if (isStart) { if (isStart) {
self.startPoi = poi; self.startPoi = poi;

View File

@@ -18,10 +18,12 @@
@property (nonatomic , strong) UIBarButtonItem *rightItem; @property (nonatomic , strong) UIBarButtonItem *rightItem;
@property (nonatomic ,strong)UIButton * backBtn; @property (nonatomic ,strong)UIButton * backBtn;
@property (nonatomic , strong) NSArray *dataArr; @property (nonatomic , strong) NSMutableArray *dataArr;
@property (nonatomic, strong) UITextField *inputAddressTf; @property (nonatomic, strong) UITextField *inputAddressTf;
@property (nonatomic, strong) AMapSearchAPI *search; @property (nonatomic, strong) AMapSearchAPI *search;
@property (nonatomic,assign)NSInteger currPage;
@end @end
@implementation ASearchAddressController @implementation ASearchAddressController
@@ -30,6 +32,9 @@
[super viewDidLoad]; [super viewDidLoad];
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
self.title = @"选择地点"; self.title = @"选择地点";
self.currPage = 1;
_dataArr = [NSMutableArray array];
[self initSubview]; [self initSubview];
@@ -80,6 +85,7 @@
btn.layer.borderWidth = 1; btn.layer.borderWidth = 1;
btn.layer.cornerRadius = 5; btn.layer.cornerRadius = 5;
btn.titleLabel.font = [UIFont systemFontOfSize:12]; btn.titleLabel.font = [UIFont systemFontOfSize:12];
btn.hidden = YES;
[btn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal]; [btn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
[btn addTarget:self action:@selector(searchBtnAction) forControlEvents:UIControlEventTouchUpInside]; [btn addTarget:self action:@selector(searchBtnAction) forControlEvents:UIControlEventTouchUpInside];
@@ -134,6 +140,14 @@
// [self.navigationController popViewControllerAnimated:YES]; // [self.navigationController popViewControllerAnimated:YES];
} }
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row == self.dataArr.count - 1 && (self.dataArr.count % 20 == 0)) {
self.currPage = self.currPage + 1;
[self requestAddressWithAddress:self.inputAddressTf.text atPage:self.currPage];
}
}
#pragma mark - #pragma mark -
- (UITableView *)tableView { - (UITableView *)tableView {
if (!_tableView) { if (!_tableView) {
@@ -189,6 +203,7 @@
// request.types = @"高等院校"; // request.types = @"高等院校";
// request.requireExtension = YES; // request.requireExtension = YES;
request.offset =20; request.offset =20;
request.page = 1;
/* SDK 3.2.0 POI*/ /* SDK 3.2.0 POI*/
request.cityLimit = YES; request.cityLimit = YES;
@@ -199,6 +214,27 @@
} }
-(void)requestAddressWithAddress:(NSString *)addr atPage:(NSInteger)page {
AMapPOIKeywordsSearchRequest *request = [[AMapPOIKeywordsSearchRequest alloc] init];
request.keywords = addr;
AMapNavSDKManager * sdk = [AMapNavSDKManager sharedManager];
request.city = sdk.localCity;
// request.types = @"高等院校";
// request.requireExtension = YES;
request.offset =20;
request.page = page;
/* SDK 3.2.0 POI*/
request.cityLimit = YES;
// request.requireSubPOIs = YES;
[self.search AMapPOIKeywordsSearch:request];
}
#pragma mark - #pragma mark -
/* POI . */ /* POI . */
@@ -212,7 +248,8 @@
//responsePOI Demo //responsePOI Demo
self.dataArr = [NSArray arrayWithArray:pois]; [self.dataArr addObjectsFromArray:pois];
[self.tableView reloadData]; [self.tableView reloadData];
} }
@@ -221,6 +258,8 @@
- (BOOL)textFieldShouldReturn:(UITextField *)textField { - (BOOL)textFieldShouldReturn:(UITextField *)textField {
[textField resignFirstResponder]; [textField resignFirstResponder];
[self.dataArr removeAllObjects];
self.currPage = 1;
[self startSearchWithAddress:textField.text]; [self startSearchWithAddress:textField.text];

View File

@@ -39,6 +39,19 @@ NS_ASSUME_NONNULL_BEGIN
/// 过路费,如 @"30元";若 nil 则隐藏 /// 过路费,如 @"30元";若 nil 则隐藏
@property (nonatomic, copy, nullable) NSString *tollFee; @property (nonatomic, copy, nullable) NSString *tollFee;
/// 营业时间,如 @"00:00-24:00";有值显示,无值显示 -
@property (nonatomic, copy, nullable) NSString *businessHours;
/// 站点联系人,如 @"陈凯";有值显示,无值显示 -
@property (nonatomic, copy, nullable) NSString *contactName;
/// 联系方式,如 @"18019187371";有值显示,无值显示 -
@property (nonatomic, copy, nullable) NSString *contactPhone;
/// 加氢价格,如 @"32元/L";有值显示,无值显示 -
@property (nonatomic, copy, nullable) NSString *hydrogenPrice;
@property (nonatomic, weak, nullable) id<AStationDetailPopupDelegate> delegate; @property (nonatomic, weak, nullable) id<AStationDetailPopupDelegate> delegate;
/// 以半透明蒙层方式弹出在目标控制器上 /// 以半透明蒙层方式弹出在目标控制器上
@@ -50,6 +63,9 @@ NS_ASSUME_NONNULL_BEGIN
/// 关闭弹框,动画结束后执行 completion用于关闭后再 present 其他页面) /// 关闭弹框,动画结束后执行 completion用于关闭后再 present 其他页面)
- (void)dismissWithCompletion:(nullable void(^)(void))completion; - (void)dismissWithCompletion:(nullable void(^)(void))completion;
-(void)resetUI;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -57,6 +57,21 @@ static inline UIColor *AStationThemeGreen(void) {
/// bottom constraint /// bottom constraint
@property (nonatomic, strong) MASConstraint *cardBottomConstraint; @property (nonatomic, strong) MASConstraint *cardBottomConstraint;
//
@property (nonatomic, strong) UILabel *businessHoursLabel;
//
@property (nonatomic, strong) UIImageView *contactPersonIconView;
@property (nonatomic, strong) UILabel *contactPersonLabel;
//
@property (nonatomic, strong) UIImageView *priceIconView;
@property (nonatomic, strong) UILabel *priceLabel;
//
@property (nonatomic, strong) UIImageView *phoneIconView;
@property (nonatomic, strong) UILabel *phoneLabel;
@end @end
@implementation AStationDetailPopupController @implementation AStationDetailPopupController
@@ -121,6 +136,26 @@ static inline UIColor *AStationThemeGreen(void) {
if (self.isViewLoaded) [self _updateUI]; if (self.isViewLoaded) [self _updateUI];
} }
- (void)setBusinessHours:(NSString *)businessHours {
_businessHours = [businessHours copy];
if (self.isViewLoaded) [self _updateUI];
}
- (void)setContactName:(NSString *)contactName {
_contactName = [contactName copy];
if (self.isViewLoaded) [self _updateUI];
}
- (void)setContactPhone:(NSString *)contactPhone {
_contactPhone = [contactPhone copy];
if (self.isViewLoaded) [self _updateUI];
}
- (void)setHydrogenPrice:(NSString *)hydrogenPrice {
_hydrogenPrice = [hydrogenPrice copy];
if (self.isViewLoaded) [self _updateUI];
}
#pragma mark - Build UI #pragma mark - Build UI
/** /**
@@ -168,10 +203,13 @@ static inline UIColor *AStationThemeGreen(void) {
[card addSubview:closeBtn]; [card addSubview:closeBtn];
self.closeButton = closeBtn; self.closeButton = closeBtn;
UIColor * headTextColor = [UIColor hp_colorWithRGBHex:0x1D2129];
UIFont * headTextFont = [UIFont hp_pingFangMedium:14];
// //
UILabel *nameLabel = [[UILabel alloc] init]; UILabel *nameLabel = [[UILabel alloc] init];
nameLabel.font = [UIFont boldSystemFontOfSize:18]; nameLabel.font = [UIFont hp_pingFangMedium:18];
nameLabel.textColor = [UIColor colorWithWhite:0.1 alpha:1]; nameLabel.textColor = headTextColor;
nameLabel.numberOfLines = 2; nameLabel.numberOfLines = 2;
// nameLabel.adjustsFontSizeToFitWidth = YES; // nameLabel.adjustsFontSizeToFitWidth = YES;
nameLabel.minimumScaleFactor = 0.8; nameLabel.minimumScaleFactor = 0.8;
@@ -180,8 +218,8 @@ static inline UIColor *AStationThemeGreen(void) {
// 20pt // 20pt
UILabel *costLabel = [[UILabel alloc] init]; UILabel *costLabel = [[UILabel alloc] init];
costLabel.font = [UIFont systemFontOfSize:14]; costLabel.font = headTextFont;
costLabel.textColor = [UIColor colorWithWhite:0.2 alpha:1]; costLabel.textColor = headTextColor;
costLabel.numberOfLines = 1; costLabel.numberOfLines = 1;
costLabel.textAlignment = NSTextAlignmentLeft; costLabel.textAlignment = NSTextAlignmentLeft;
// [costLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; // [costLabel setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
@@ -189,10 +227,18 @@ static inline UIColor *AStationThemeGreen(void) {
[card addSubview:costLabel]; [card addSubview:costLabel];
self.costLabel = costLabel; self.costLabel = costLabel;
// 4pt
UILabel *bizHoursLabel = [[UILabel alloc] init];
bizHoursLabel.font = [UIFont hp_pingFangRegular:14];
bizHoursLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129];
bizHoursLabel.numberOfLines = 1;
[card addSubview:bizHoursLabel];
self.businessHoursLabel = bizHoursLabel;
// //
UILabel *addrLabel = [[UILabel alloc] init]; UILabel *addrLabel = [[UILabel alloc] init];
addrLabel.font = [UIFont systemFontOfSize:13]; addrLabel.font = [UIFont hp_pingFangRegular:14];
addrLabel.textColor = [UIColor colorWithWhite:0.5 alpha:1]; addrLabel.textColor = [UIColor hp_colorWithRGBHex:0x86909C];
addrLabel.numberOfLines = 2; addrLabel.numberOfLines = 2;
[card addSubview:addrLabel]; [card addSubview:addrLabel];
self.addressLabel = addrLabel; self.addressLabel = addrLabel;
@@ -212,45 +258,84 @@ static inline UIColor *AStationThemeGreen(void) {
// //
UIImageView *timeIcon = [[UIImageView alloc] init]; UIImageView *timeIcon = [[UIImageView alloc] init];
timeIcon.contentMode = UIViewContentModeScaleAspectFit; timeIcon.contentMode = UIViewContentModeScaleAspectFit;
timeIcon.image = [AMapNavCommonUtil imageWithName3x:@"pre_time_icon"]; timeIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_time"];
[card addSubview:timeIcon]; [card addSubview:timeIcon];
self.timeIconView = timeIcon; self.timeIconView = timeIcon;
// //
UILabel *timeLabel = [[UILabel alloc] init]; UILabel *timeLabel = [[UILabel alloc] init];
timeLabel.font = [UIFont systemFontOfSize:14]; timeLabel.font = headTextFont;
timeLabel.textColor = [UIColor colorWithWhite:0.2 alpha:1]; timeLabel.textColor = headTextColor;
[card addSubview:timeLabel]; [card addSubview:timeLabel];
self.timeLabel = timeLabel; self.timeLabel = timeLabel;
// //
UIImageView *distIcon = [[UIImageView alloc] init]; UIImageView *distIcon = [[UIImageView alloc] init];
distIcon.contentMode = UIViewContentModeScaleAspectFit; distIcon.contentMode = UIViewContentModeScaleAspectFit;
distIcon.image = [AMapNavCommonUtil imageWithName3x:@"pre_distance_icon"]; distIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_mileage"];
[card addSubview:distIcon]; [card addSubview:distIcon];
self.distanceIconView = distIcon; self.distanceIconView = distIcon;
// //
UILabel *distLabel = [[UILabel alloc] init]; UILabel *distLabel = [[UILabel alloc] init];
distLabel.font = [UIFont systemFontOfSize:14]; distLabel.font = headTextFont;
distLabel.textColor = [UIColor colorWithWhite:0.2 alpha:1]; distLabel.textColor = headTextColor;
[card addSubview:distLabel]; [card addSubview:distLabel];
self.distanceLabel = distLabel; self.distanceLabel = distLabel;
// //
UIImageView *tollIcon = [[UIImageView alloc] init]; UIImageView *tollIcon = [[UIImageView alloc] init];
tollIcon.contentMode = UIViewContentModeScaleAspectFit; tollIcon.contentMode = UIViewContentModeScaleAspectFit;
tollIcon.image = [AMapNavCommonUtil imageWithName3x:@"pre_cost_icon"]; tollIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_toll"];
[card addSubview:tollIcon]; [card addSubview:tollIcon];
self.tollIconView = tollIcon; self.tollIconView = tollIcon;
// //
UILabel *tollLabel = [[UILabel alloc] init]; UILabel *tollLabel = [[UILabel alloc] init];
tollLabel.font = [UIFont systemFontOfSize:14]; tollLabel.font = headTextFont;
tollLabel.textColor = [UIColor colorWithWhite:0.2 alpha:1]; tollLabel.textColor = headTextColor;
[card addSubview:tollLabel]; [card addSubview:tollLabel];
self.tollLabel = tollLabel; self.tollLabel = tollLabel;
// &
UIImageView *personIcon = [[UIImageView alloc] init];
personIcon.contentMode = UIViewContentModeScaleAspectFit;
personIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_person"];
[card addSubview:personIcon];
self.contactPersonIconView = personIcon;
UILabel *personLabel = [[UILabel alloc] init];
personLabel.font = headTextFont;
personLabel.textColor = headTextColor;
[card addSubview:personLabel];
self.contactPersonLabel = personLabel;
// &
UIImageView *priceIcon = [[UIImageView alloc] init];
priceIcon.contentMode = UIViewContentModeScaleAspectFit;
priceIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_price"];
[card addSubview:priceIcon];
self.priceIconView = priceIcon;
UILabel *priceLabel = [[UILabel alloc] init];
priceLabel.font = headTextFont;
priceLabel.textColor = headTextColor;
[card addSubview:priceLabel];
self.priceLabel = priceLabel;
// &
UIImageView *phoneIcon = [[UIImageView alloc] init];
phoneIcon.contentMode = UIViewContentModeScaleAspectFit;
phoneIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_phone"];
[card addSubview:phoneIcon];
self.phoneIconView = phoneIcon;
UILabel *phoneLabel = [[UILabel alloc] init];
phoneLabel.font = headTextFont;
phoneLabel.textColor = headTextColor;
[card addSubview:phoneLabel];
self.phoneLabel = phoneLabel;
// //
UIButton *naviBtn = [UIButton buttonWithType:UIButtonTypeCustom]; UIButton *naviBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[naviBtn setTitle:@"开始导航" forState:UIControlStateNormal]; [naviBtn setTitle:@"开始导航" forState:UIControlStateNormal];
@@ -301,24 +386,34 @@ static inline UIColor *AStationThemeGreen(void) {
make.right.equalTo(self.closeButton.mas_left).offset(-12); make.right.equalTo(self.closeButton.mas_left).offset(-12);
}]; }];
// 6pt // 6pt
[self.addressLabel mas_makeConstraints:^(MASConstraintMaker *make) { [self.businessHoursLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.stationNameLabel.mas_bottom).offset(10); make.top.equalTo(self.stationNameLabel.mas_bottom).offset(10);
make.left.equalTo(card).offset(16); make.left.equalTo(card).offset(16);
make.right.equalTo(card).offset(-16); make.right.equalTo(card).offset(-16);
}]; }];
// 6pt
[self.addressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.businessHoursLabel.mas_bottom).offset(10);
make.left.equalTo(card).offset(16);
make.right.equalTo(card).offset(-16);
}];
self.separator.hidden = YES;
// 线12pt // 线12pt
[self.separator mas_makeConstraints:^(MASConstraintMaker *make) { [self.separator mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.addressLabel.mas_bottom).offset(15); make.top.equalTo(self.addressLabel.mas_bottom).offset(10);
make.left.equalTo(card).offset(16); make.left.equalTo(card).offset(16);
make.right.equalTo(card).offset(-16); make.right.equalTo(card).offset(-16);
make.height.mas_equalTo(0.5); make.height.mas_equalTo(0.5);
}]; }];
CGFloat _offset_y = 18;
// 线14pt // 线14pt
[self.timeIconView mas_makeConstraints:^(MASConstraintMaker *make) { [self.timeIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.separator.mas_bottom).offset(15); make.top.equalTo(self.separator.mas_bottom).offset(12);
make.left.equalTo(card).offset(16); make.left.equalTo(card).offset(16);
make.width.height.mas_equalTo(iconSize); make.width.height.mas_equalTo(iconSize);
}]; }];
@@ -333,7 +428,7 @@ static inline UIColor *AStationThemeGreen(void) {
///cost ///cost
[self.costIconView mas_makeConstraints:^(MASConstraintMaker *make) { [self.costIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.timeIconView); make.centerY.equalTo(self.timeIconView);
make.left.equalTo(self.timeLabel.mas_right).offset(30); make.left.equalTo(self.timeLabel.mas_right).offset(40);
make.width.height.mas_equalTo(iconSize); make.width.height.mas_equalTo(iconSize);
}]; }];
@@ -346,7 +441,7 @@ static inline UIColor *AStationThemeGreen(void) {
// + 12pt // + 12pt
[self.distanceIconView mas_makeConstraints:^(MASConstraintMaker *make) { [self.distanceIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.timeIconView.mas_bottom).offset(15); make.top.equalTo(self.timeIconView.mas_bottom).offset(_offset_y);
make.left.equalTo(card).offset(16); make.left.equalTo(card).offset(16);
make.width.height.mas_equalTo(iconSize); make.width.height.mas_equalTo(iconSize);
}]; }];
@@ -372,9 +467,49 @@ static inline UIColor *AStationThemeGreen(void) {
make.height.mas_equalTo(24); make.height.mas_equalTo(24);
}]; }];
// 18pt30pt // 14pt
[self.contactPersonIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.distanceIconView.mas_bottom).offset(_offset_y);
make.left.equalTo(card).offset(16);
make.width.height.mas_equalTo(iconSize);
}];
[self.contactPersonLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.contactPersonIconView);
make.left.equalTo(self.contactPersonIconView.mas_right).offset(6);
make.height.mas_equalTo(24);
}];
// costIconView
[self.priceIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.contactPersonIconView);
make.left.equalTo(self.costIconView.mas_left);
make.width.height.mas_equalTo(iconSize);
}];
[self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.contactPersonIconView);
make.left.equalTo(self.priceIconView.mas_right).offset(6);
make.right.lessThanOrEqualTo(card).offset(-10);
make.height.mas_equalTo(24);
}];
// 12pt
[self.phoneIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.contactPersonIconView.mas_bottom).offset(_offset_y);
make.left.equalTo(card).offset(16);
make.width.height.mas_equalTo(iconSize);
}];
[self.phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.phoneIconView);
make.left.equalTo(self.phoneIconView.mas_right).offset(6);
make.height.mas_equalTo(24);
}];
// 18pt safeArea
[self.startNaviButton mas_makeConstraints:^(MASConstraintMaker *make) { [self.startNaviButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.distanceIconView.mas_bottom).offset(50); make.top.equalTo(self.phoneIconView.mas_bottom).offset(40);
make.left.equalTo(card).offset(16); make.left.equalTo(card).offset(16);
make.right.equalTo(card).offset(-16); make.right.equalTo(card).offset(-16);
make.height.mas_equalTo(48); make.height.mas_equalTo(48);
@@ -386,29 +521,63 @@ static inline UIColor *AStationThemeGreen(void) {
- (void)_updateUI { - (void)_updateUI {
self.stationNameLabel.text = (self.pointModel.name.length > 0) self.stationNameLabel.text = (self.pointModel.name.length > 0)
? self.pointModel.name : @"--"; ? self.pointModel.name : @"-";
//
self.businessHoursLabel.text = (self.businessHours.length > 0)
? [NSString stringWithFormat:@"营业时间:%@", self.businessHours]
: @"营业时间:-";
self.costLabel.text = (self.estimatedCost.length > 0) self.costLabel.text = (self.estimatedCost.length > 0)
? [NSString stringWithFormat:@"预计加氢费用:%@元", self.estimatedCost] ? [NSString stringWithFormat:@"预计加氢费用:%@元", self.estimatedCost]
: @"预计加氢费用:--元"; : @"预计加氢费用:-";
self.addressLabel.text = (self.pointModel.address.length > 0) self.addressLabel.text = (self.pointModel.address.length > 0)
? self.pointModel.address : @"--"; ? self.pointModel.address : @"-";
// "-- 分钟" // "-- 分钟"
self.timeLabel.text = (self.estimatedTime.length > 0) self.timeLabel.text = (self.estimatedTime.length > 0)
? [NSString stringWithFormat:@"预计时间:%@分钟", self.estimatedTime] ? [NSString stringWithFormat:@"预计时间:%@分钟", self.estimatedTime]
: @"预计时间:--分钟"; : @"预计时间:-";
// "-- 公里" // "-- 公里"
self.distanceLabel.text = (self.driveDistance.length > 0) self.distanceLabel.text = (self.driveDistance.length > 0)
? [NSString stringWithFormat:@"行驶里程:%@公里", self.driveDistance] ? [NSString stringWithFormat:@"行驶里程:%@公里", self.driveDistance]
: @"行驶里程:--公里"; : @"行驶里程:-";
// "-- 元" // "-- 元"
self.tollLabel.text = (self.tollFee.length > 0) self.tollLabel.text = (self.tollFee.length > 0)
? [NSString stringWithFormat:@"过路费:%@元", self.tollFee] ? [NSString stringWithFormat:@"过路费:%@元", self.tollFee]
: @"过路费:--元"; : @"过路费:-";
// -
self.contactPersonLabel.text = (self.contactName.length > 0)
? [NSString stringWithFormat:@"站联系人:%@", self.contactName]
: @"站联系人:-";
// -
self.priceLabel.text = (self.hydrogenPrice.length > 0)
? [NSString stringWithFormat:@"加氢价格:%@/L", self.hydrogenPrice]
: @"加氢价格:-";
// -
self.phoneLabel.text = (self.contactPhone.length > 0)
? [NSString stringWithFormat:@"联系方式:%@", self.contactPhone]
: @"联系方式:-";
}
// UI
-(void)resetUI {
self.stationNameLabel.text = @"-";
self.businessHoursLabel.text = @"营业时间:-";
self.costLabel.text = @"预计加氢费用:-";
self.addressLabel.text = @"地址:-";
self.timeLabel.text = @"预计时间:-";
self.distanceLabel.text = @"行驶里程:-";
self.tollLabel.text = @"过路费:-";
self.contactPersonLabel.text = @"站联系人:-";
self.priceLabel.text = @"加氢价格:-";
self.phoneLabel.text = @"联系方式:-";
} }
#pragma mark - Animation #pragma mark - Animation

View File

@@ -59,6 +59,11 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, copy, nullable) NSString *latitude; @property (nonatomic, copy, nullable) NSString *latitude;
@property (nonatomic, copy, nullable) NSString *distance; @property (nonatomic, copy, nullable) NSString *distance;
///新增弹框参数4.13
@property (nonatomic, copy, nullable) NSString *hydrogenPrice;
@property (nonatomic, copy, nullable) NSString *liaisonName;
@property (nonatomic, copy, nullable) NSString *liaisonPhone;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -7,6 +7,8 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "UIColor+ANavMap.h"
#import "UIFont+HP.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@@ -34,6 +36,8 @@ BOOL stringIsEmpty(NSString *str);
/// 判断字符串是否非空 /// 判断字符串是否非空
BOOL stringIsNotEmpty(NSString *str); BOOL stringIsNotEmpty(NSString *str);
+(NSString *)stringValueFromStr:(NSString *)str;
@end @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -117,6 +117,15 @@ BOOL stringIsNotEmpty (NSString *str)
return ! stringIsEmpty(str); return ! stringIsEmpty(str);
} }
///
+(NSString *)stringValueFromStr:(NSString *)str {
if (stringIsEmpty(str)) {
return @"";
}
return str;
}
#pragma mark - #pragma mark -
+(UIImage *)imageWithName:(NSString *)name { +(UIImage *)imageWithName:(NSString *)name {

View File

@@ -0,0 +1,20 @@
//
// UIColor+ANavMap.h
// AMapNavIOSSDK
//
// Created by admin on 2026/4/11.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIColor (ANavMap)
+ (UIColor *)hp_colorWithRGBHex:(UInt32)hex;
+ (UIColor *)hp_colorWithRGBHex:(UInt32)hex alpha:(CGFloat)alpha;
//格式AHEX
+ (UIColor *)hp_colorWithRGBAHEX:(UInt32)hex;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,53 @@
//
// UIColor+ANavMap.m
// AMapNavIOSSDK
//
// Created by admin on 2026/4/11.
//
#import "UIColor+ANavMap.h"
@implementation UIColor (ANavMap)
//HEX
+ (UIColor *)hp_colorWithRGBHex:(UInt32)hex
{
CGFloat r = (hex >> 16) & 0xFF;
CGFloat g = (hex >> 8) & 0xFF;
CGFloat b = (hex) & 0xFF;
CGFloat a = 1.0f;
return [UIColor colorWithRed:r / 255.0f
green:g / 255.0f
blue:b / 255.0f
alpha:a];
}
+ (UIColor *)hp_colorWithRGBHex:(UInt32)hex alpha:(CGFloat)alpha
{
CGFloat r = (hex >> 16) & 0xFF;
CGFloat g = (hex >> 8) & 0xFF;
CGFloat b = (hex) & 0xFF;
CGFloat a = alpha;
return [UIColor colorWithRed:r / 255.0f
green:g / 255.0f
blue:b / 255.0f
alpha:a];
}
//AHEX
+ (UIColor *)hp_colorWithRGBAHEX:(UInt32)hex
{
CGFloat r = (hex >> 24) & 0xFF;
CGFloat g = (hex >> 16) & 0xFF;
CGFloat b = (hex >> 8) & 0xFF;
CGFloat a = (hex) & 0xFF;
return [UIColor colorWithRed:r / 255.0f
green:g / 255.0f
blue:b / 255.0f
alpha:a / 255.0f];
}
@end

View File

@@ -0,0 +1,36 @@
//
// UIFont+HP.h
// Hippo
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/**
* UIFont 快捷分类
* 统一使用 PingFang SC 字族,覆盖 Light / Regular / Medium / Semibold 四个字重。
*
* 使用示例:
* label.font = [UIFont hp_pingFangLight:14];
* label.font = [UIFont hp_pingFangRegular:16];
* label.font = [UIFont hp_pingFangMedium:15];
* label.font = [UIFont hp_pingFangSemibold:18];
*/
@interface UIFont (HP)
#pragma mark - PingFang SC Light细体
+ (UIFont *)hp_pingFangLight:(CGFloat)size;
#pragma mark - PingFang SC Regular常规
+ (UIFont *)hp_pingFangRegular:(CGFloat)size;
#pragma mark - PingFang SC Medium中等
+ (UIFont *)hp_pingFangMedium:(CGFloat)size;
#pragma mark - PingFang SC Semibold半粗
+ (UIFont *)hp_pingFangSemibold:(CGFloat)size;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,45 @@
//
// UIFont+HP.m
// Hippo
//
#import "UIFont+HP.h"
// PingFang SC
static NSString * const kHPFontPingFangLight = @"PingFangSC-Light";
static NSString * const kHPFontPingFangRegular = @"PingFangSC-Regular";
static NSString * const kHPFontPingFangMedium = @"PingFangSC-Medium";
static NSString * const kHPFontPingFangSemibold = @"PingFangSC-Semibold";
@implementation UIFont (HP)
#pragma mark - PingFang SC Light
+ (UIFont *)hp_pingFangLight:(CGFloat)size {
UIFont *font = [UIFont fontWithName:kHPFontPingFangLight size:size];
// 退
return font ?: [UIFont systemFontOfSize:size weight:UIFontWeightLight];
}
#pragma mark - PingFang SC Regular
+ (UIFont *)hp_pingFangRegular:(CGFloat)size {
UIFont *font = [UIFont fontWithName:kHPFontPingFangRegular size:size];
return font ?: [UIFont systemFontOfSize:size weight:UIFontWeightRegular];
}
#pragma mark - PingFang SC Medium
+ (UIFont *)hp_pingFangMedium:(CGFloat)size {
UIFont *font = [UIFont fontWithName:kHPFontPingFangMedium size:size];
return font ?: [UIFont systemFontOfSize:size weight:UIFontWeightMedium];
}
#pragma mark - PingFang SC Semibold
+ (UIFont *)hp_pingFangSemibold:(CGFloat)size {
UIFont *font = [UIFont fontWithName:kHPFontPingFangSemibold size:size];
return font ?: [UIFont systemFontOfSize:size weight:UIFontWeightSemibold];
}
@end

View File

@@ -163,6 +163,7 @@ static inline UIColor *ABottomBarThemeGreen(void) {
self.calRouteButton = btn; self.calRouteButton = btn;
CGFloat off_y = AMP_TabbarHeight; CGFloat off_y = AMP_TabbarHeight;
off_y = 0;
#ifdef kAMapSDKDebugFlag #ifdef kAMapSDKDebugFlag
off_y = 0; off_y = 0;
#endif #endif
@@ -172,7 +173,7 @@ static inline UIColor *ABottomBarThemeGreen(void) {
make.left.equalTo(card).offset(16); make.left.equalTo(card).offset(16);
make.right.equalTo(card).offset(-16); make.right.equalTo(card).offset(-16);
make.height.mas_equalTo(48); make.height.mas_equalTo(48);
make.bottom.equalTo(card).offset(-40 - off_y); make.bottom.equalTo(card).offset(-40);
}]; }];
} }

View File

@@ -0,0 +1,70 @@
//
// AStationDetailPopupView.h
// AMapNavIOSSDK
//
// Created by admin on 2026/3/22.
//
#import <UIKit/UIKit.h>
#import "ANavPointModel.h"
#import "AMapNavSDKHeader.h"
NS_ASSUME_NONNULL_BEGIN
@class AStationDetailPopupView;
@protocol AStationDetailPopupViewDelegate <NSObject>
@optional
/// 点击"开始导航"
- (void)stationDetailPopupViewDidTapStartNavi:(AStationDetailPopupView *)popup;
/// 点击关闭
- (void)stationDetailPopupViewDidTapClose:(AStationDetailPopupView *)popup;
@end
@interface AStationDetailPopupView : UIView
@property (nonatomic, strong, nullable) ANavPointModel *pointModel;
/// 预计加氢费用(元),可由外部传入;若 nil 则隐藏
@property (nonatomic, copy, nullable) NSString *estimatedCost;
/// 预计时间,如 @"15分钟";若 nil 则隐藏
@property (nonatomic, copy, nullable) NSString *estimatedTime;
/// 行驶里程,如 @"23.5公里";若 nil 则隐藏
@property (nonatomic, copy, nullable) NSString *driveDistance;
/// 过路费,如 @"30元";若 nil 则隐藏
@property (nonatomic, copy, nullable) NSString *tollFee;
/// 营业时间,如 @"00:00-24:00";有值显示,无值显示 -
@property (nonatomic, copy, nullable) NSString *businessHours;
/// 站点联系人,如 @"陈凯";有值显示,无值显示 -
@property (nonatomic, copy, nullable) NSString *contactName;
/// 联系方式,如 @"18019187371";有值显示,无值显示 -
@property (nonatomic, copy, nullable) NSString *contactPhone;
/// 加氢价格,如 @"32元/L";有值显示,无值显示 -
@property (nonatomic, copy, nullable) NSString *hydrogenPrice;
@property (nonatomic, weak, nullable) id<AStationDetailPopupViewDelegate> delegate;
/// 显示弹框动画
- (void)showInView:(UIView *)parentView;
/// 隐藏弹框动画
- (void)hideWithCompletion:(nullable void(^)(void))completion;
/// 隐藏弹框动画(无 completion
- (void)hide;
/// 重置 UI 状态
- (void)resetUI;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,655 @@
//
// AStationDetailPopupView.m
// AMapNavIOSSDK
//
// Created by admin on 2026/3/22.
//
#import "AStationDetailPopupView.h"
#import "AMapNavCommonUtil.h"
#import <Masonry/Masonry.h>
// 绿
static inline UIColor *AStationThemeGreen(void) {
return [UIColor colorWithRed:0x1A/255.0 green:0x7C/255.0 blue:0x43/255.0 alpha:1.0];
}
@interface AStationDetailPopupView ()
///
@property (nonatomic, strong) UIControl *maskControl;
///
@property (nonatomic, strong) UIView *cardView;
///
@property (nonatomic, strong) UILabel *stationNameLabel;
///
@property (nonatomic, strong) UIImageView *costIconView;
@property (nonatomic, strong) UILabel *costLabel;
///
@property (nonatomic, strong) UILabel *addressLabel;
/// 线
@property (nonatomic, strong) UIView *separator;
///
@property (nonatomic, strong) UIImageView *timeIconView;
@property (nonatomic, strong) UILabel *timeLabel;
///
@property (nonatomic, strong) UIImageView *distanceIconView;
@property (nonatomic, strong) UILabel *distanceLabel;
///
@property (nonatomic, strong) UIImageView *tollIconView;
@property (nonatomic, strong) UILabel *tollLabel;
///
@property (nonatomic, strong) UIButton *closeButton;
///
@property (nonatomic, strong) UIButton *startNaviButton;
//
@property (nonatomic, strong) UILabel *businessHoursLabel;
//
@property (nonatomic, strong) UIImageView *contactPersonIconView;
@property (nonatomic, strong) UILabel *contactPersonLabel;
//
@property (nonatomic, strong) UIImageView *priceIconView;
@property (nonatomic, strong) UILabel *priceLabel;
//
@property (nonatomic, strong) UIImageView *phoneIconView;
@property (nonatomic, strong) UILabel *phoneLabel;
/// bottom constraint
@property (nonatomic, strong) MASConstraint *cardBottomConstraint;
@end
@implementation AStationDetailPopupView
#pragma mark - Init
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
self.backgroundColor = [UIColor clearColor];
[self _buildUI];
[self _setupMasonryConstraints];
[self _updateUI];
}
return self;
}
#pragma mark - Public
- (void)showInView:(UIView *)parentView {
self.alpha = 0;
self.maskControl.alpha = 0;
[parentView addSubview:self];
[self mas_remakeConstraints:^(MASConstraintMaker *make) {
// make.edges.equalTo(parentView);
make.top.left.right.equalTo(parentView);
make.bottom.equalTo(parentView).offset((-AMP_TabbarSafeBottomMargin - 35));
}];
[self _playShowAnimation];
}
- (void)hide {
[self hideWithCompletion:nil];
}
- (void)hideWithCompletion:(void(^)(void))completion {
[self _playDismissAnimationWithCompletion:^{
[self removeFromSuperview];
if (completion) {
completion();
}
}];
}
#pragma mark - Setter Override
- (void)setPointModel:(ANavPointModel *)pointModel {
_pointModel = pointModel;
[self _updateUI];
}
- (void)setEstimatedCost:(NSString *)estimatedCost {
_estimatedCost = [estimatedCost copy];
[self _updateUI];
}
- (void)setEstimatedTime:(NSString *)estimatedTime {
_estimatedTime = [estimatedTime copy];
[self _updateUI];
}
- (void)setDriveDistance:(NSString *)driveDistance {
_driveDistance = [driveDistance copy];
[self _updateUI];
}
- (void)setTollFee:(NSString *)tollFee {
_tollFee = [tollFee copy];
[self _updateUI];
}
- (void)setBusinessHours:(NSString *)businessHours {
_businessHours = [businessHours copy];
[self _updateUI];
}
- (void)setContactName:(NSString *)contactName {
_contactName = [contactName copy];
[self _updateUI];
}
- (void)setContactPhone:(NSString *)contactPhone {
_contactPhone = [contactPhone copy];
[self _updateUI];
}
- (void)setHydrogenPrice:(NSString *)hydrogenPrice {
_hydrogenPrice = [hydrogenPrice copy];
[self _updateUI];
}
#pragma mark - Build UI
/**
[]
-- 20pt
[icon] --
[icon] -- [icon] --
(30pt)
*/
- (void)_buildUI {
//
UIControl *mask = [[UIControl alloc] init];
mask.backgroundColor = [UIColor colorWithWhite:0 alpha:0.35];
[mask addTarget:self action:@selector(_onMaskTapped) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:mask];
self.maskControl = mask;
//
UIView *card = [[UIView alloc] init];
card.backgroundColor = [UIColor whiteColor];
card.layer.cornerRadius = 16;
card.layer.masksToBounds = NO;
card.layer.shadowColor = [UIColor blackColor].CGColor;
card.layer.shadowOpacity = 0.15;
card.layer.shadowRadius = 12;
card.layer.shadowOffset = CGSizeMake(0, -4);
[self addSubview:card];
self.cardView = card;
//
UIButton *closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[closeBtn setImage:[AMapNavCommonUtil imageWithName:@"icon_close"] forState:UIControlStateNormal];
[closeBtn setTitleColor:[UIColor colorWithWhite:0.5 alpha:1] forState:UIControlStateNormal];
closeBtn.titleLabel.font = [UIFont systemFontOfSize:16];
[closeBtn addTarget:self action:@selector(_onCloseTapped) forControlEvents:UIControlEventTouchUpInside];
[card addSubview:closeBtn];
self.closeButton = closeBtn;
UIColor *headTextColor = [UIColor hp_colorWithRGBHex:0x1D2129];
UIFont *headTextFont = [UIFont hp_pingFangMedium:14];
//
UILabel *nameLabel = [[UILabel alloc] init];
nameLabel.font = [UIFont hp_pingFangMedium:18];
nameLabel.textColor = headTextColor;
nameLabel.numberOfLines = 2;
nameLabel.minimumScaleFactor = 0.8;
[card addSubview:nameLabel];
self.stationNameLabel = nameLabel;
// 20pt
UILabel *costLabel = [[UILabel alloc] init];
costLabel.font = headTextFont;
costLabel.textColor = headTextColor;
costLabel.numberOfLines = 1;
costLabel.textAlignment = NSTextAlignmentLeft;
[card addSubview:costLabel];
self.costLabel = costLabel;
// 4pt
UILabel *bizHoursLabel = [[UILabel alloc] init];
bizHoursLabel.font = [UIFont hp_pingFangRegular:14];
bizHoursLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129];
bizHoursLabel.numberOfLines = 1;
[card addSubview:bizHoursLabel];
self.businessHoursLabel = bizHoursLabel;
//
UILabel *addrLabel = [[UILabel alloc] init];
addrLabel.font = [UIFont hp_pingFangRegular:14];
addrLabel.textColor = [UIColor hp_colorWithRGBHex:0x86909C];
addrLabel.numberOfLines = 2;
[card addSubview:addrLabel];
self.addressLabel = addrLabel;
UIImageView *costIcon = [[UIImageView alloc] init];
costIcon.contentMode = UIViewContentModeScaleAspectFit;
costIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_fuel"];
[card addSubview:costIcon];
self.costIconView = costIcon;
// 线
UIView *sep = [[UIView alloc] init];
sep.backgroundColor = [UIColor colorWithWhite:0.88 alpha:1];
[card addSubview:sep];
self.separator = sep;
//
UIImageView *timeIcon = [[UIImageView alloc] init];
timeIcon.contentMode = UIViewContentModeScaleAspectFit;
timeIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_time"];
[card addSubview:timeIcon];
self.timeIconView = timeIcon;
//
UILabel *timeLabel = [[UILabel alloc] init];
timeLabel.font = headTextFont;
timeLabel.textColor = headTextColor;
[card addSubview:timeLabel];
self.timeLabel = timeLabel;
//
UIImageView *distIcon = [[UIImageView alloc] init];
distIcon.contentMode = UIViewContentModeScaleAspectFit;
distIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_mileage"];
[card addSubview:distIcon];
self.distanceIconView = distIcon;
//
UILabel *distLabel = [[UILabel alloc] init];
distLabel.font = headTextFont;
distLabel.textColor = headTextColor;
[card addSubview:distLabel];
self.distanceLabel = distLabel;
//
UIImageView *tollIcon = [[UIImageView alloc] init];
tollIcon.contentMode = UIViewContentModeScaleAspectFit;
tollIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_toll"];
[card addSubview:tollIcon];
self.tollIconView = tollIcon;
//
UILabel *tollLabel = [[UILabel alloc] init];
tollLabel.font = headTextFont;
tollLabel.textColor = headTextColor;
[card addSubview:tollLabel];
self.tollLabel = tollLabel;
// &
UIImageView *personIcon = [[UIImageView alloc] init];
personIcon.contentMode = UIViewContentModeScaleAspectFit;
personIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_person"];
[card addSubview:personIcon];
self.contactPersonIconView = personIcon;
UILabel *personLabel = [[UILabel alloc] init];
personLabel.font = headTextFont;
personLabel.textColor = headTextColor;
[card addSubview:personLabel];
self.contactPersonLabel = personLabel;
// &
UIImageView *priceIcon = [[UIImageView alloc] init];
priceIcon.contentMode = UIViewContentModeScaleAspectFit;
priceIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_price"];
[card addSubview:priceIcon];
self.priceIconView = priceIcon;
UILabel *priceLabel = [[UILabel alloc] init];
priceLabel.font = headTextFont;
priceLabel.textColor = headTextColor;
[card addSubview:priceLabel];
self.priceLabel = priceLabel;
// &
UIImageView *phoneIcon = [[UIImageView alloc] init];
phoneIcon.contentMode = UIViewContentModeScaleAspectFit;
phoneIcon.image = [AMapNavCommonUtil imageWithName3x:@"ic_phone"];
[card addSubview:phoneIcon];
self.phoneIconView = phoneIcon;
UILabel *phoneLabel = [[UILabel alloc] init];
phoneLabel.font = headTextFont;
phoneLabel.textColor = headTextColor;
[card addSubview:phoneLabel];
self.phoneLabel = phoneLabel;
//
UIButton *naviBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[naviBtn setTitle:@"开始导航" forState:UIControlStateNormal];
[naviBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
naviBtn.titleLabel.font = [UIFont boldSystemFontOfSize:17];
naviBtn.backgroundColor = AStationThemeGreen();
naviBtn.layer.cornerRadius = 24;
[naviBtn addTarget:self action:@selector(_onStartNaviTapped) forControlEvents:UIControlEventTouchUpInside];
[card addSubview:naviBtn];
self.startNaviButton = naviBtn;
}
#pragma mark - Masonry Constraints
- (void)_setupMasonryConstraints {
UIView *card = self.cardView;
CGFloat iconSize = 16;
//
[self.maskControl mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self);
}];
// 16
[card mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self).offset(0);
make.right.equalTo(self).offset(-0);
make.bottom.equalTo(self).offset(-0);
}];
//
[self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(card).offset(8);
make.right.equalTo(card).offset(-15);
make.width.height.mas_equalTo(40);
}];
//
[self.stationNameLabel setContentHuggingPriority:UILayoutPriorityDefaultLow
forAxis:UILayoutConstraintAxisHorizontal];
[self.stationNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(card).offset(25);
make.left.equalTo(card).offset(16);
make.right.equalTo(self.closeButton.mas_left).offset(-12);
}];
// 10pt
[self.businessHoursLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.stationNameLabel.mas_bottom).offset(10);
make.left.equalTo(card).offset(16);
make.right.equalTo(card).offset(-16);
}];
// 10pt
[self.addressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.businessHoursLabel.mas_bottom).offset(10);
make.left.equalTo(card).offset(16);
make.right.equalTo(card).offset(-16);
}];
self.separator.hidden = YES;
// 线10pt
[self.separator mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.addressLabel.mas_bottom).offset(10);
make.left.equalTo(card).offset(16);
make.right.equalTo(card).offset(-16);
make.height.mas_equalTo(0.5);
}];
CGFloat _offset_y = 18;
// 线12pt
[self.timeIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.separator.mas_bottom).offset(12);
make.left.equalTo(card).offset(16);
make.width.height.mas_equalTo(iconSize);
}];
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.timeIconView);
make.left.equalTo(self.timeIconView.mas_right).offset(6);
make.height.mas_equalTo(24);
}];
/// cost
[self.costIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.timeIconView);
make.left.equalTo(self.timeLabel.mas_right).offset(40);
make.width.height.mas_equalTo(iconSize);
}];
[self.costLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.costIconView);
make.left.equalTo(self.costIconView.mas_right).offset(6);
make.right.lessThanOrEqualTo(card).offset(-10);
}];
// + 12pt
[self.distanceIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.timeIconView.mas_bottom).offset(_offset_y);
make.left.equalTo(card).offset(16);
make.width.height.mas_equalTo(iconSize);
}];
[self.distanceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.distanceIconView);
make.left.equalTo(self.distanceIconView.mas_right).offset(6);
make.width.mas_lessThanOrEqualTo(130);
make.height.mas_equalTo(24);
}];
[self.tollIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.distanceIconView);
make.left.equalTo(self.costIconView.mas_left);
make.width.height.mas_equalTo(iconSize);
}];
[self.tollLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.distanceIconView);
make.left.equalTo(self.tollIconView.mas_right).offset(6);
make.height.mas_equalTo(24);
}];
// 14pt
[self.contactPersonIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.distanceIconView.mas_bottom).offset(_offset_y);
make.left.equalTo(card).offset(16);
make.width.height.mas_equalTo(iconSize);
}];
[self.contactPersonLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.contactPersonIconView);
make.left.equalTo(self.contactPersonIconView.mas_right).offset(6);
// make.height.mas_equalTo(24);
make.width.lessThanOrEqualTo(self).multipliedBy(0.4);
}];
// costIconView
[self.priceIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.contactPersonIconView);
make.left.equalTo(self.costIconView.mas_left);
make.width.height.mas_equalTo(iconSize);
}];
[self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.contactPersonIconView);
make.left.equalTo(self.priceIconView.mas_right).offset(6);
make.right.lessThanOrEqualTo(card).offset(-10);
make.height.mas_equalTo(24);
}];
// 12pt
[self.phoneIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.contactPersonIconView.mas_bottom).offset(_offset_y);
make.left.equalTo(card).offset(16);
make.width.height.mas_equalTo(iconSize);
}];
[self.phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.phoneIconView);
make.left.equalTo(self.phoneIconView.mas_right).offset(6);
make.height.mas_equalTo(24);
}];
// 18pt safeArea
[self.startNaviButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.phoneIconView.mas_bottom).offset(40);
make.left.equalTo(card).offset(16);
make.right.equalTo(card).offset(-16);
make.height.mas_equalTo(48);
make.bottom.equalTo(card).offset(-AMP_TabbarSafeBottomMargin);
}];
}
#pragma mark - Data Update
- (void)_updateUI {
self.stationNameLabel.text = (self.pointModel.name.length > 0)
? self.pointModel.name : @"-";
//
self.businessHoursLabel.text = (self.businessHours.length > 0)
? [NSString stringWithFormat:@"营业时间:%@", self.businessHours]
: @"营业时间:-";
self.costLabel.text = (self.estimatedCost.length > 0)
? [NSString stringWithFormat:@"预计加氢费用:%@元", self.estimatedCost]
: @"预计加氢费用:-";
self.addressLabel.text = (self.pointModel.address.length > 0)
? self.pointModel.address : @"-";
// "-- 分钟"
self.timeLabel.text = (self.estimatedTime.length > 0)
? [NSString stringWithFormat:@"预计时间:%@分钟", self.estimatedTime]
: @"预计时间:-";
// "-- 公里"
self.distanceLabel.text = (self.driveDistance.length > 0)
? [NSString stringWithFormat:@"行驶里程:%@公里", self.driveDistance]
: @"行驶里程:-";
// "-- 元"
self.tollLabel.text = (self.tollFee.length > 0)
? [NSString stringWithFormat:@"过路费:%@元", self.tollFee]
: @"过路费:-";
// -
self.contactPersonLabel.text = (self.contactName.length > 0)
? [NSString stringWithFormat:@"站联系人:%@", self.contactName]
: @"站联系人:-";
// -
self.priceLabel.text = (self.hydrogenPrice.length > 0)
? [NSString stringWithFormat:@"加氢价格:%@/L", self.hydrogenPrice]
: @"加氢价格:-";
// -
self.phoneLabel.text = (self.contactPhone.length > 0)
? [NSString stringWithFormat:@"联系方式:%@", self.contactPhone]
: @"联系方式:-";
}
// UI
- (void)resetUI {
self.stationNameLabel.text = @"-";
self.businessHoursLabel.text = @"营业时间:-";
self.costLabel.text = @"预计加氢费用:-";
self.addressLabel.text = @"地址:-";
self.timeLabel.text = @"预计时间:-";
self.distanceLabel.text = @"行驶里程:-";
self.tollLabel.text = @"过路费:-";
self.contactPersonLabel.text = @"站联系人:-";
self.priceLabel.text = @"加氢价格:-";
self.phoneLabel.text = @"联系方式:-";
}
#pragma mark - Animation
/**
*/
- (void)_playShowAnimation {
//
[self.cardView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self).offset(0);
make.right.equalTo(self).offset(-0);
make.top.equalTo(self.mas_bottom).offset(0);
}];
[self layoutIfNeeded];
//
[self.cardView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self).offset(0);
make.right.equalTo(self).offset(-0);
make.bottom.equalTo(self).offset(-AMP_TabbarSafeBottomMargin);
}];
[UIView animateWithDuration:0.36
delay:0
usingSpringWithDamping:0.82
initialSpringVelocity:0.5
options:UIViewAnimationOptionCurveEaseOut
animations:^{
self.alpha = 1;
self.maskControl.alpha = 1;
[self layoutIfNeeded];
} completion:nil];
}
- (void)_playDismissAnimationWithCompletion:(void(^)(void))completion {
[self.cardView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self).offset(0);
make.right.equalTo(self).offset(-0);
make.top.equalTo(self.mas_bottom).offset(20);
}];
[UIView animateWithDuration:0.25
delay:0
options:UIViewAnimationOptionCurveEaseIn
animations:^{
self.maskControl.alpha = 0;
[self layoutIfNeeded];
} completion:^(BOOL finished) {
if (completion) completion();
}];
}
#pragma mark - Actions
- (void)_onMaskTapped {
if ([self.delegate respondsToSelector:@selector(stationDetailPopupViewDidTapClose:)]) {
[self.delegate stationDetailPopupViewDidTapClose:self];
}
[self hide];
}
- (void)_onCloseTapped {
if ([self.delegate respondsToSelector:@selector(stationDetailPopupViewDidTapClose:)]) {
[self.delegate stationDetailPopupViewDidTapClose:self];
}
[self hide];
}
- (void)_onStartNaviTapped {
__weak typeof(self) weakSelf = self;
[self hideWithCompletion:^{
__strong typeof(weakSelf) strongSelf = weakSelf;
if ([strongSelf.delegate respondsToSelector:@selector(stationDetailPopupViewDidTapStartNavi:)]) {
[strongSelf.delegate stationDetailPopupViewDidTapStartNavi:strongSelf];
}
}];
}
@end