百度地图(自定义标签、气泡)
来源:互联网 发布:知乎的收藏夹在哪 编辑:程序博客网 时间:2024/04/30 04:14
昨天写了一篇文章是关于百度地图定位的,刚好最近在写关于地图的模块,把工作中用到的记录下来,边学边用,也挺好的(不过太寂寞,不知道干什么)
今天就写一些自定义标签,弹出的气泡方法
挺简单的,直接上代码吧
if([annotationisKindOfClass:[BMKPointAnnotationclass]]) {
BMKPinAnnotationView*newAnnotation = [[BMKPinAnnotationViewalloc]initWithAnnotation:annotationreuseIdentifier:@"myAnnotation"];
newAnnotation.pinColor=BMKPinAnnotationColorPurple;
newAnnotation.animatesDrop=YES;
//设置弹出气泡图片
UIView*popView = [[UIViewalloc]initWithFrame:CGRectMake(0,0,240,280)];
popView.backgroundColor= [UIColorwhiteColor];
//image
UIImageView*image = [[UIImageViewalloc]initWithImage:[UIImageimageNamed:@"moren"]];
image.frame=CGRectMake(0,0,240,140);
[popViewaddSubview:image];
//image1 text1
UIImageView*image1 = [[UIImageViewalloc]initWithImage:[UIImageimageNamed:@"yingpian2_ico_"]];
image1.frame=CGRectMake(10,150,20,20);
[popViewaddSubview:image1];
UILabel*driverName = [[UILabelalloc]initWithFrame:CGRectMake(40,145,100,30)];
driverName.text=@"绝地逃亡";
driverName.font= [UIFontboldSystemFontOfSize:14];
driverName.textAlignment=NSTextAlignmentLeft;
[popViewaddSubview:driverName];
//text2
UILabel*name2 = [[UILabelalloc]initWithFrame:CGRectMake(10,185,100,20)];
name2.text=@"成龙";
name2.font= [UIFontboldSystemFontOfSize:13];
name2.textAlignment=NSTextAlignmentLeft;
[popViewaddSubview:name2];
//text3
UILabel*name3 = [[UILabelalloc]initWithFrame:CGRectMake(10,210,100,20)];
name3.text=@"中国云南";
name3.font= [UIFontsystemFontOfSize:13];
name3.textAlignment=NSTextAlignmentLeft;
[popViewaddSubview:name3];
//button
UIButton*btn = [UIButtonbuttonWithType:UIButtonTypeCustom];
btn.frame=CGRectMake(0,250,240,30);
[btn setTitle:@"进入"forState:UIControlStateNormal];
btn.backgroundColor= [UIColorcolorWithRed:236/255.0green:85/255.0blue:77/255.0alpha:1];
// [btn setBackgroundImage:[UIImage imageNamed:@"wo_beijing"] forState:UIControlStateNormal];
[popViewaddSubview:btn];
BMKActionPaopaoView*pView = [[BMKActionPaopaoViewalloc]initWithCustomView:popView];
pView.frame=CGRectMake(0,0,240,280);
((BMKPinAnnotationView*)newAnnotation).paopaoView=nil;
((BMKPinAnnotationView*)newAnnotation).paopaoView= pView;
returnnewAnnotation;
}
最后效果图,点击大头针出现
我创建了一个交流群,大家可以加一下一起交流 ”进修Android~iOS+“ 群:237311061 大神在里面,而且群里面会分享有一些iOS课件
0 0
- 百度地图(自定义标签、气泡)
- 百度地图自定义气泡
- 百度地图自定义气泡
- 百度地图使用(二)自定义大头针和弹出气泡
- 百度地图使用(二)自定义大头针和弹出气泡
- iOS 自定义百度地图标注气泡
- 百度地图自定义弹出气泡和大头针
- IOS百度地图气泡内容自定义
- iOS-百度地图添加标注自定义气泡
- IOS百度地图自定义大头针和气泡
- IOS百度地图自定义大头针和气泡
- IOS 调用百度地图(SDK) 进行定位以及自定义位置弹出框(气泡)
- android版百度地图 自定义 点击当前位置弹出气泡
- android版百度地图 自定义 点击当前位置弹出气泡
- android版百度地图 自定义 点击当前位置弹出气泡
- 百度地图IOS 自定义图标气泡viewForAnnotation不调用
- 百度地图使用-自定义大头针和弹出气泡
- iOS百度地图自定义大头针和气泡内的内容
- Perforce(P4V) TIPS
- LoadRuner的LOG日志设置
- android手机连接android wear (手表模拟器)的连接
- W3AF:一个web应用安全的攻击、审计平台
- 移动平台GPU浮点测试
- 百度地图(自定义标签、气泡)
- UIViewController
- FRM-40654 记录已经被另一个用户更新,重新查询以查看修改
- cgroup介绍、安装和控制cpu,内存,io示例
- 性能之巅:Linux网络性能分析工具
- 织梦DedeCMS任意位置调用自定义字段的方法
- MetaHandler.js:移动端适配各种屏幕
- HTTP响应头和请求头信息对照表
- 查看本机SHA1码和MD5码