ios点击大头针气泡不弹出_百度地图使用(二)自定义大头针和弹出气泡
百度地圖使用(二)自定義大頭針和彈出氣泡
(2014-08-19 10:37:09)
標簽:
時尚
分類:
IOS
http://www.aichengxu.com/article/系統優化/11497_12.html
// 根據anntation生成對應的View
- (BMKAnnotationView *)mapView:(BMKMapView *)mapView viewForAnnotation:(id )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;
}
分享:
喜歡
0
贈金筆
加載中,請稍候......
評論加載中,請稍候...
發評論
登錄名: 密碼: 找回密碼 注冊記住登錄狀態
昵???稱:
評論并轉載此博文
發評論
以上網友發言只代表其個人觀點,不代表新浪網的觀點或立場。
總結
以上是生活随笔為你收集整理的ios点击大头针气泡不弹出_百度地图使用(二)自定义大头针和弹出气泡的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python redis集群_Pytho
- 下一篇: f12获取网页文本_怎么获取网页源代码中