@@ -68,9 +68,6 @@ static inline UIColor *AStationThemeGreen(void) {
@ property ( nonatomic , strong ) UIImageView * phoneIconView ;
@ property ( nonatomic , strong ) UILabel * phoneLabel ;
// / 卡 片 bottom constraint ( 动 画 用 )
@ property ( nonatomic , strong ) MASConstraint * cardBottomConstraint ;
@ end
@ implementation AStationDetailPopupView
@@ -81,277 +78,43 @@ static inline UIColor *AStationThemeGreen(void) {
self = [ super initWithFrame : frame ] ;
if ( self ) {
self . backgroundColor = [ UIColor clearColor ] ;
[ self _build UI] ;
[ self _setupMasonryConstraints ] ;
[ self _updateUI ] ;
[ self setup UI] ;
}
return self ;
}
# pragma mark - Public
# pragma mark - Setup UI
- ( void ) showInView : ( UIView * ) parentView {
self . alpha = 0 ;
self . maskControl . alpha = 0 ;
[ parent View 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 ) setupUI {
[ self addSubview : self . maskControl ] ;
[ self . cardView addSubview : self . closeButton ] ;
[ self . card View addSubview : self . stationNameLabel ] ;
[ self . cardView addSubview : self . costLabel ] ;
[ self . cardView addSubview : self . businessHoursLabel ] ;
[ self . cardView addSubview : self . addressLabel ] ;
[ self . cardView addSubview : self . costIconView ] ;
[ self . cardView addSubview : self . separator ] ;
[ self . cardView addSubview : self . timeIconView ] ;
[ self . cardView addSubview : self . timeLabel ] ;
[ self . cardView addSubview : self . distanceIconView ] ;
[ self . cardView addSubview : self . distanceLabel ] ;
[ self . cardView addSubview : self . tollIconView ] ;
[ self . cardView addSubview : self . tollLabel ] ;
[ self . cardView addSubview : self . contactPersonIconView ] ;
[ self . cardView addSubview : self . contactPersonLabel ] ;
[ self . cardView addSubview : self . priceIconView ] ;
[ self . cardView addSubview : self . priceLabel ] ;
[ self . cardView addSubview : self . phoneIconView ] ;
[ self . cardView addSubview : self . phoneLabel ] ;
[ self . cardView addSubview : self . startNaviButton ] ;
- ( 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
/ * *
卡 片 结 构 :
┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ [ ✕ ] ┐
│ 站 点 名 称 ( 加 粗 ) 预 计 加 氢 费 用 : - - 元 │ ← 同 行 , 间 距 20 pt
│ 地 址 ( 灰 色 小 字 , 多 行 ) │
│ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ │
│ [ icon ] 预 计 时 间 : - - 分 钟 │
│ [ icon ] 行 驶 里 程 : - - 公 里 [ icon ] 过 路 费 : - - 元 │
│ ╔ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ╗ │
│ ║ 开 始 导 航 ║ │
│ ╚ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ═ ╝ │
│ ( 距 底 部 30 pt ) │
└ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘
* /
- ( void ) _buildUI {
// ─ ─ 蒙 层 ─ ─
UIControl * mask = [ [ UIControl alloc ] init ] ;
mask . backgroundColor = [ UIColor colorWithWhite : 0 alpha : 0 ] ;
[ 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 : 0 x1D2129 ] ;
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 ;
// ─ ─ 预 计 加 氢 费 用 ( 名 称 右 侧 , 间 距 20 pt ) ─ ─
UILabel * costLabel = [ [ UILabel alloc ] init ] ;
costLabel . font = headTextFont ;
costLabel . textColor = headTextColor ;
costLabel . numberOfLines = 1 ;
costLabel . textAlignment = NSTextAlignmentLeft ;
[ card addSubview : costLabel ] ;
self . costLabel = costLabel ;
// ─ ─ 营 业 时 间 ( 站 点 名 称 下 方 , 4 pt 间 距 , 浅 灰 色 小 字 ) ─ ─
UILabel * bizHoursLabel = [ [ UILabel alloc ] init ] ;
bizHoursLabel . font = [ UIFont hp_pingFangRegular : 14 ] ;
bizHoursLabel . textColor = [ UIColor hp_colorWithRGBHex : 0 x1D2129 ] ;
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 : 0 x86909C ] ;
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 ;
[ self setupConstraints ] ;
[ self updateUI ] ;
}
# pragma mark - Masonry Constraints
- ( void ) _ setupMasonry Constraints {
- ( void ) setupConstraints {
UIView * card = self . cardView ;
CGFloat iconSize = 16 ;
@@ -507,13 +270,85 @@ static inline UIColor *AStationThemeGreen(void) {
make . left . equalTo ( card ) . offset ( 16 ) ;
make . right . equalTo ( card ) . offset ( -16 ) ;
make . height . mas_equalTo ( 48 ) ;
make . bottom . equalTo ( card ) . offset ( - AMP_TabbarSafeBottomMargin ) ;
make . bottom . equalTo ( card ) . offset ( - AMP_TabbarSafeBottomMargin + ( - AMP_TabbarHeight - 13 ) ) ;
} ] ;
}
# 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 ) ;
} ] ;
[ 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 - Data Update
- ( void ) _ updateUI {
- ( void ) updateUI {
self . stationNameLabel . text = ( self . pointModel . name . length > 0 )
? self . pointModel . name : @ "-" ;
@@ -522,7 +357,7 @@ static inline UIColor *AStationThemeGreen(void) {
? [ NSString stringWithFormat : @ "营业时间:%@" , self . businessHours ]
: @ "营业时间:-" ;
self . costLabel . text = ( self . estimatedCost . length > 0 )
self . costLabel . text = ( ( self . estimatedCost . length > 0 ) && [ self . estimatedCost doubleValue ] )
? [ NSString stringWithFormat : @ "预计加氢费用:%@元" , self . estimatedCost ]
: @ "预计加氢费用:-" ;
@@ -530,12 +365,12 @@ static inline UIColor *AStationThemeGreen(void) {
? self . pointModel . address : @ "-" ;
// ─ ─ 预 计 时 间 ( 始 终 显 示 , 无 值 显 示 "-- 分钟" ) ─ ─
self . timeLabel . text = ( self . estimatedTime . length > 0 )
self . timeLabel . text = ( ( self . estimatedTime . length > 0 ) && [ self . estimatedTime doubleValue ] > 0 )
? [ NSString stringWithFormat : @ "预计时间:%@分钟" , self . estimatedTime ]
: @ "预计时间:-" ;
// ─ ─ 行 驶 里 程 ( 始 终 显 示 , 无 值 显 示 "-- 公里" ) ─ ─
self . distanceLabel . text = ( self . driveDistance . length > 0 )
self . distanceLabel . text = ( ( self . driveDistance . length > 0 ) && [ self . driveDistance doubleValue ] > 0 )
? [ NSString stringWithFormat : @ "行驶里程:%@公里" , self . driveDistance ]
: @ "行驶里程:-" ;
@@ -560,7 +395,6 @@ static inline UIColor *AStationThemeGreen(void) {
: @ "联系方式:-" ;
}
// 重 置 UI 状 态
- ( void ) resetUI {
self . stationNameLabel . text = @ "-" ;
self . businessHoursLabel . text = @ "营业时间:-" ;
@@ -579,7 +413,7 @@ static inline UIColor *AStationThemeGreen(void) {
/ * *
弹 入 动 画
* /
- ( void ) _ playShowAnimation {
- ( void ) playShowAnimation {
// 初 始 状 态 : 卡 片 在 屏 幕 下 方 ( 完 全 隐 藏 在 屏 幕 外 )
[ self . cardView mas_remakeConstraints : ^ ( MASConstraintMaker * make ) {
make . left . equalTo ( self ) . offset ( 0 ) ;
@@ -593,7 +427,7 @@ static inline UIColor *AStationThemeGreen(void) {
[ 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 ) ;
make . bottom . equalTo ( self ) . offset ( 0 ) ;
} ] ;
[ UIView animateWithDuration : 0.36
@@ -608,7 +442,7 @@ static inline UIColor *AStationThemeGreen(void) {
} completion : nil ] ;
}
- ( void ) _ playDismissAnimationWithCompletion: ( void ( ^ ) ( void ) ) completion {
- ( void ) playDismissAnimationWithCompletion: ( void ( ^ ) ( void ) ) completion {
[ self . cardView mas_remakeConstraints : ^ ( MASConstraintMaker * make ) {
make . left . equalTo ( self ) . offset ( 0 ) ;
make . right . equalTo ( self ) . offset ( -0 ) ;
@@ -628,21 +462,21 @@ static inline UIColor *AStationThemeGreen(void) {
# pragma mark - Actions
- ( void ) _ onMaskTapped {
- ( void ) onMaskTapped {
if ( [ self . delegate respondsToSelector : @ selector ( stationDetailPopupViewDidTapClose : ) ] ) {
[ self . delegate stationDetailPopupViewDidTapClose : self ] ;
}
[ self hide ] ;
}
- ( void ) _ onCloseTapped {
- ( void ) onCloseTapped {
if ( [ self . delegate respondsToSelector : @ selector ( stationDetailPopupViewDidTapClose : ) ] ) {
[ self . delegate stationDetailPopupViewDidTapClose : self ] ;
}
[ self hide ] ;
}
- ( void ) _ onStartNaviTapped {
- ( void ) onStartNaviTapped {
__weak typeof ( self ) weakSelf = self ;
[ self hideWithCompletion : ^ {
__strong typeof ( weakSelf ) strongSelf = weakSelf ;
@@ -652,4 +486,222 @@ static inline UIColor *AStationThemeGreen(void) {
} ] ;
}
# pragma mark - Lazy Load
- ( UIControl * ) maskControl {
if ( ! _maskControl ) {
_maskControl = [ [ UIControl alloc ] init ] ;
_maskControl . backgroundColor = [ UIColor colorWithWhite : 0 alpha : 0 ] ;
[ _maskControl addTarget : self action : @ selector ( onMaskTapped ) forControlEvents : UIControlEventTouchUpInside ] ;
}
return _maskControl ;
}
- ( UIView * ) cardView {
if ( ! _cardView ) {
_cardView = [ [ UIView alloc ] init ] ;
_cardView . backgroundColor = [ UIColor whiteColor ] ;
_cardView . layer . cornerRadius = 16 ;
_cardView . layer . masksToBounds = NO ;
_cardView . layer . shadowColor = [ UIColor blackColor ] . CGColor ;
_cardView . layer . shadowOpacity = 0.15 ;
_cardView . layer . shadowRadius = 12 ;
_cardView . layer . shadowOffset = CGSizeMake ( 0 , -4 ) ;
[ self addSubview : _cardView ] ;
}
return _cardView ;
}
- ( UIButton * ) closeButton {
if ( ! _closeButton ) {
_closeButton = [ UIButton buttonWithType : UIButtonTypeCustom ] ;
[ _closeButton setImage : [ AMapNavCommonUtil imageWithName : @ "icon_close" ] forState : UIControlStateNormal ] ;
[ _closeButton setTitleColor : [ UIColor colorWithWhite : 0.5 alpha : 1 ] forState : UIControlStateNormal ] ;
_closeButton . titleLabel . font = [ UIFont systemFontOfSize : 16 ] ;
[ _closeButton addTarget : self action : @ selector ( onCloseTapped ) forControlEvents : UIControlEventTouchUpInside ] ;
}
return _closeButton ;
}
- ( UILabel * ) stationNameLabel {
if ( ! _stationNameLabel ) {
_stationNameLabel = [ [ UILabel alloc ] init ] ;
_stationNameLabel . font = [ UIFont hp_pingFangMedium : 18 ] ;
_stationNameLabel . textColor = [ UIColor hp_colorWithRGBHex : 0 x1D2129 ] ;
_stationNameLabel . numberOfLines = 2 ;
_stationNameLabel . minimumScaleFactor = 0.8 ;
}
return _stationNameLabel ;
}
- ( UILabel * ) costLabel {
if ( ! _costLabel ) {
_costLabel = [ [ UILabel alloc ] init ] ;
_costLabel . font = [ UIFont hp_pingFangMedium : 14 ] ;
_costLabel . textColor = [ UIColor hp_colorWithRGBHex : 0 x1D2129 ] ;
_costLabel . numberOfLines = 1 ;
_costLabel . textAlignment = NSTextAlignmentLeft ;
}
return _costLabel ;
}
- ( UILabel * ) businessHoursLabel {
if ( ! _businessHoursLabel ) {
_businessHoursLabel = [ [ UILabel alloc ] init ] ;
_businessHoursLabel . font = [ UIFont hp_pingFangRegular : 14 ] ;
_businessHoursLabel . textColor = [ UIColor hp_colorWithRGBHex : 0 x1D2129 ] ;
_businessHoursLabel . numberOfLines = 1 ;
}
return _businessHoursLabel ;
}
- ( UILabel * ) addressLabel {
if ( ! _addressLabel ) {
_addressLabel = [ [ UILabel alloc ] init ] ;
_addressLabel . font = [ UIFont hp_pingFangRegular : 14 ] ;
_addressLabel . textColor = [ UIColor hp_colorWithRGBHex : 0 x86909C ] ;
_addressLabel . numberOfLines = 2 ;
}
return _addressLabel ;
}
- ( UIImageView * ) costIconView {
if ( ! _costIconView ) {
_costIconView = [ [ UIImageView alloc ] init ] ;
_costIconView . contentMode = UIViewContentModeScaleAspectFit ;
_costIconView . image = [ AMapNavCommonUtil imageWithName3x : @ "ic_fuel" ] ;
}
return _costIconView ;
}
- ( UIView * ) separator {
if ( ! _separator ) {
_separator = [ [ UIView alloc ] init ] ;
_separator . backgroundColor = [ UIColor colorWithWhite : 0.88 alpha : 1 ] ;
_separator . hidden = YES ;
}
return _separator ;
}
- ( UIImageView * ) timeIconView {
if ( ! _timeIconView ) {
_timeIconView = [ [ UIImageView alloc ] init ] ;
_timeIconView . contentMode = UIViewContentModeScaleAspectFit ;
_timeIconView . image = [ AMapNavCommonUtil imageWithName3x : @ "ic_time" ] ;
}
return _timeIconView ;
}
- ( UILabel * ) timeLabel {
if ( ! _timeLabel ) {
_timeLabel = [ [ UILabel alloc ] init ] ;
_timeLabel . font = [ UIFont hp_pingFangMedium : 14 ] ;
_timeLabel . textColor = [ UIColor hp_colorWithRGBHex : 0 x1D2129 ] ;
}
return _timeLabel ;
}
- ( UIImageView * ) distanceIconView {
if ( ! _distanceIconView ) {
_distanceIconView = [ [ UIImageView alloc ] init ] ;
_distanceIconView . contentMode = UIViewContentModeScaleAspectFit ;
_distanceIconView . image = [ AMapNavCommonUtil imageWithName3x : @ "ic_mileage" ] ;
}
return _distanceIconView ;
}
- ( UILabel * ) distanceLabel {
if ( ! _distanceLabel ) {
_distanceLabel = [ [ UILabel alloc ] init ] ;
_distanceLabel . font = [ UIFont hp_pingFangMedium : 14 ] ;
_distanceLabel . textColor = [ UIColor hp_colorWithRGBHex : 0 x1D2129 ] ;
}
return _distanceLabel ;
}
- ( UIImageView * ) tollIconView {
if ( ! _tollIconView ) {
_tollIconView = [ [ UIImageView alloc ] init ] ;
_tollIconView . contentMode = UIViewContentModeScaleAspectFit ;
_tollIconView . image = [ AMapNavCommonUtil imageWithName3x : @ "ic_toll" ] ;
}
return _tollIconView ;
}
- ( UILabel * ) tollLabel {
if ( ! _tollLabel ) {
_tollLabel = [ [ UILabel alloc ] init ] ;
_tollLabel . font = [ UIFont hp_pingFangMedium : 14 ] ;
_tollLabel . textColor = [ UIColor hp_colorWithRGBHex : 0 x1D2129 ] ;
}
return _tollLabel ;
}
- ( UIImageView * ) contactPersonIconView {
if ( ! _contactPersonIconView ) {
_contactPersonIconView = [ [ UIImageView alloc ] init ] ;
_contactPersonIconView . contentMode = UIViewContentModeScaleAspectFit ;
_contactPersonIconView . image = [ AMapNavCommonUtil imageWithName3x : @ "ic_person" ] ;
}
return _contactPersonIconView ;
}
- ( UILabel * ) contactPersonLabel {
if ( ! _contactPersonLabel ) {
_contactPersonLabel = [ [ UILabel alloc ] init ] ;
_contactPersonLabel . font = [ UIFont hp_pingFangMedium : 14 ] ;
_contactPersonLabel . textColor = [ UIColor hp_colorWithRGBHex : 0 x1D2129 ] ;
}
return _contactPersonLabel ;
}
- ( UIImageView * ) priceIconView {
if ( ! _priceIconView ) {
_priceIconView = [ [ UIImageView alloc ] init ] ;
_priceIconView . contentMode = UIViewContentModeScaleAspectFit ;
_priceIconView . image = [ AMapNavCommonUtil imageWithName3x : @ "ic_price" ] ;
}
return _priceIconView ;
}
- ( UILabel * ) priceLabel {
if ( ! _priceLabel ) {
_priceLabel = [ [ UILabel alloc ] init ] ;
_priceLabel . font = [ UIFont hp_pingFangMedium : 14 ] ;
_priceLabel . textColor = [ UIColor hp_colorWithRGBHex : 0 x1D2129 ] ;
}
return _priceLabel ;
}
- ( UIImageView * ) phoneIconView {
if ( ! _phoneIconView ) {
_phoneIconView = [ [ UIImageView alloc ] init ] ;
_phoneIconView . contentMode = UIViewContentModeScaleAspectFit ;
_phoneIconView . image = [ AMapNavCommonUtil imageWithName3x : @ "ic_phone" ] ;
}
return _phoneIconView ;
}
- ( UILabel * ) phoneLabel {
if ( ! _phoneLabel ) {
_phoneLabel = [ [ UILabel alloc ] init ] ;
_phoneLabel . font = [ UIFont hp_pingFangMedium : 14 ] ;
_phoneLabel . textColor = [ UIColor hp_colorWithRGBHex : 0 x1D2129 ] ;
}
return _phoneLabel ;
}
- ( UIButton * ) startNaviButton {
if ( ! _startNaviButton ) {
_startNaviButton = [ UIButton buttonWithType : UIButtonTypeCustom ] ;
[ _startNaviButton setTitle : @ "开始导航" forState : UIControlStateNormal ] ;
[ _startNaviButton setTitleColor : [ UIColor whiteColor ] forState : UIControlStateNormal ] ;
_startNaviButton . titleLabel . font = [ UIFont boldSystemFontOfSize : 17 ] ;
_startNaviButton . backgroundColor = AStationThemeGreen ( ) ;
_startNaviButton . layer . cornerRadius = 24 ;
[ _startNaviButton addTarget : self action : @ selector ( onStartNaviTapped ) forControlEvents : UIControlEventTouchUpInside ] ;
}
return _startNaviButton ;
}
@ end