导航中自定义UI控件是指导航页面底部UI支持添加自定义控件。支持定制区域的示意图如下
开发者可以在底部剩余时间距离视图的下面和上面添加自定义视图
实现自定义视图,需要执行以下操作:
(1)设置好自定义视图的高度
(2)创建自定义视图,添加到主视图中
(3)设置车标的偏移量
具体使用方式:
#define CAR_BOTTOMHEIGHT 0#define CAR_NAVILOCATIONOFFSET 50#define CAR_TOOLBARVIEWTOPSPACE 40
-(void)enterNavi {BNaviService_Strategy.bottomButtonHeight = CAR_BOTTOMHEIGHT;BNaviService_Strategy.toolBarViewTopSpace = CAR_TOOLBARVIEWTOPSPACE;BNaviService_Strategy.naviLocationOffset = CAR_NAVILOCATIONOFFSET;[BNaviService_UI showPage:BNaviUI_NormalNavi delegate:self extParams:@{BNaviUI_NormalNavi_TypeKey: @(BN_NaviTypeTruck)}];}-(void)onHandleNaviViewDidLoad:(UIView *)naviView {if (naviView) {if ([UIApplication sharedApplication].statusBarOrientation == UIDeviceOrientationLandscapeRight || [UIApplication sharedApplication].statusBarOrientation == UIDeviceOrientationLandscapeLeft) {//当前横屏CGRect naviFrame = naviView.frame;naviFrame.size.width = naviView.frame.size.height;naviFrame.size.height = naviView.frame.size.width;naviView.frame = naviFrame;}CGFloat btnHeight = 40;__weak __typeof(UIView *) weakNaviView = naviView;UILabel *customizeTopView = [[UILabel alloc] init];customizeTopView.userInteractionEnabled = YES;customizeTopView.text = @"顶部区域";customizeTopView.textAlignment = NSTextAlignmentCenter;customizeTopView.backgroundColor = RGBA(0, 191, 255, 1);[weakNaviView addSubview:customizeTopView];customizeTopView.frame = CGRectMake(0, BNaviService_Strategy.carBottomButtonTop - btnHeight -5, weakNaviView.width, btnHeight);UILabel *customizeBottomView = [[UILabel alloc] init];customizeBottomView.text = @"底部自定义区域";customizeBottomView.textColor = [UIColor whiteColor];customizeBottomView.textAlignment = NSTextAlignmentCenter;customizeBottomView.backgroundColor = RGBA(0, 139, 139, 1);[weakNaviView addSubview:customizeBottomView];customizeBottomView.frame = CGRectMake(0, weakNaviView.height - BNaviService_Strategy.bottomButtonHeight, weakNaviView.width, BNaviService_Strategy.bottomButtonHeight);customizeBottomView.layer.masksToBounds = YES;customizeBottomView.layer.cornerRadius = 6;customizeTopView.layer.masksToBounds = YES;customizeTopView.layer.cornerRadius = 6;}}
上一篇
下一篇
本篇文章对您是否有帮助?