百度地图自定义弹出气泡和大头针
来源:互联网 发布:打电话发短信软件 编辑:程序博客网 时间:2024/04/30 06:11
直接上代码了,希望能抛夸引玉
// 根据anntation生成对应的View
- (BMKAnnotationView *)mapView:(BMKMapView *)mapView viewForAnnotation:(id <BMKAnnotation>)annotation{
NSString *AnnotationViewID = [NSString stringWithFormat:@"renameMark%d",i];
newAnnotation = [[BMKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:AnnotationViewID];
// 设置颜色
((BMKPinAnnotationView*)newAnnotation).pinColor = BMKPinAnnotationColorPurple;
// 从天上掉下效果
((BMKPinAnnotationView*)newAnnotation).animatesDrop = YES;
// 设置可拖拽
((BMKPinAnnotationView*)newAnnotation).draggable = YES;
//设置大头针图标
((BMKPinAnnotationView*)newAnnotation).image = [UIImage imageNamed:@"zhaohuoche"];
UIView *popView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 100, 60)];
//设置弹出气泡图片
UIImageView *image = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"wenzi"]];
image.frame = CGRectMake(0, 0, 100, 60);
[popView addSubview:image];
//自定义显示的内容
UILabel *driverName = [[UILabel alloc]initWithFrame:CGRectMake(0, 3, 100, 20)];
driverName.text = @"张XX师傅";
driverName.backgroundColor = [UIColor clearColor];
driverName.font = [UIFont systemFontOfSize:14];
driverName.textColor = [UIColor whiteColor];
driverName.textAlignment = NSTextAlignmentCenter;
[popView addSubview:driverName];
UILabel *carName = [[UILabel alloc]initWithFrame:CGRectMake(0, 25, 100, 20)];
carName.text = @"京A123456";
carName.backgroundColor = [UIColor clearColor];
carName.font = [UIFont systemFontOfSize:14];
carName.textColor = [UIColor whiteColor];
carName.textAlignment = NSTextAlignmentCenter;
[popView addSubview:carName];
BMKActionPaopaoView *pView = [[BMKActionPaopaoView alloc]initWithCustomView:popView];
pView.frame = CGRectMake(0, 0, 100, 60);
((BMKPinAnnotationView*)newAnnotation).paopaoView = nil;
((BMKPinAnnotationView*)newAnnotation).paopaoView = pView;
i++;
return newAnnotation;
}
怎么改,就看你需要了!
转自 http://www.aichengxu.com/article/%E7%B3%BB%E7%BB%9F%E4%BC%98%E5%8C%96/11497_12.html
0 0
- 百度地图自定义弹出气泡和大头针
- 百度地图使用(二)自定义大头针和弹出气泡
- 百度地图使用-自定义大头针和弹出气泡
- 百度地图使用(二)自定义大头针和弹出气泡
- IOS百度地图自定义大头针和气泡
- IOS百度地图自定义大头针和气泡
- iOS百度地图自定义大头针和气泡内的内容
- 百度地图自定义大头针
- 百度地图点击大头针在弹出的气泡上加按钮
- 百度地图自定义气泡
- 百度地图自定义气泡
- iOS 百度地图自定义大头针。
- android版百度地图 自定义 点击当前位置弹出气泡
- android版百度地图 自定义 点击当前位置弹出气泡
- android版百度地图 自定义 点击当前位置弹出气泡
- 百度地图自定义大头针图片和添加标注
- 百度地图大头针图片的自定义
- iOS 自定义百度地图大头针点击事件
- 有关某数的因子——分数拆分
- bzoj1015[JSOI2008]星球大战starwar
- 浅析配置更快的Eclipse方法
- Qt自定义界面类并提升(提升的窗口部件)
- C# MSDN
- 百度地图自定义弹出气泡和大头针
- Baidu MuPlayer solution(Demo)
- 解决国内无法安装android sdk的问题
- NetworkCredential 类
- MySQL事务中的隔离性-------不可重复性和幻读的区别
- mahout 实用教程 (一)
- 得到Access数据库中的所有表名
- poj 1080 Human Gene Functions(dp)
- QT:Qsocket长连接的实现(多线程服务器)