ios导航sdk | 百度地图api sdk-凯发k8官方旗舰厅

浏览器版本低!无法浏览完整内容,建议升级或更换浏览器。
自定义ui控件
下载开发文档

导航中自定义ui控件是指导航页面底部ui支持添加自定义控件,仅支持摩托车/货车。默认情况下,摩托车和货车是经典底部样式。下面介绍这种样式下支持的自定义ui控件的能力。

经典底部样式

货车和摩托车导航中底部ui只支持经典底部样式。开发者可以在底部剩余时间距离视图的下面和上面添加自定义视图。

实现自定义视图,需要执行以下操作:

(1)设置好自定义视图的高度

(2)创建自定义视图,添加到主视图中

(3)设置车标的偏移量

具体使用方式:

1. 设置自定义视图高度
#definetruck_bottomheight50
#definetruck_navilocationoffset0
#definetruck_toolbarviewtopspace40
#definecar_bottomheight0
#definecar_navilocationoffset50
#definecar_toolbarviewtopspace40
2. 创建自定义视图,添加到主视图
-(void)enternavi {
bnaviservice_strategy.bottombuttonheight=truck_bottomheight;
bnaviservice_strategy.toolbarviewtopspace=truck_toolbarviewtopspace;
bnaviservice_strategy.navilocationoffset=truck_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.truckbottombuttontop- 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;
}
}

上一篇

自定义标注

下一篇

其他自定义能力

本篇文章对您是否有帮助?

网站地图