打图钉
来源:互联网 发布:大数据4v特征 编辑:程序博客网 时间:2024/04/29 23:06
- (void)viewDidLoad
{
mapView=[MTMapViewmapViewWithFrame:CGRectMake(0, 0,self.view.bounds.size.width,self.view.bounds.size.height)Delegate:self];
if(searchRouteRsp==nil){
[UIHelp showHint:@"暂无商家" intView:self.view];
}
if(searchRouteRsp.dataArray!=nil){
NSLog(@"%d",searchRouteRsp.dataArray.count);
// MTAnnotationView *an2;
// MTLabel *label2;
for (int j=0; j<searchRouteRsp.dataArray.count; j++)
{
columnRespData=[searchRouteRsp.mColumnRespDataListobjectAtIndex:j];
NSMutableArray *extendInfoArray=[searchRouteRsp.dataArrayobjectAtIndex:j];
NSMutableArray *Level2=[extendInfoArrayobjectAtIndex:0];
NSMutableDictionary *dataDictionary=[extendInfoArrayobjectAtIndex:1];
NSLog(@"Level2--%d", Level2.count);
MapExtendInfo *mlongitude=[Level2objectAtIndex:1];
MapExtendInfo *mlatitude=[Level2objectAtIndex:2];
NSLog(@"%@",mlongitude);
UIImage *my=[UIImageimageNamed:@"pinRed.png"];
CGRect imgFrame=CGRectMake(0, 0, my.size.width, my.size.height);
MTAnnotationView *an2=[MTAnnotationViewannotationViewWithFrame:imgFrame UIImage:myDelegate:self];
// MTLabel *mtLabel=[MTLabel labelWithTitle:[NSString stringWithFormat:@"%@\r\n %@",columnRespData.mNode.nodename,[dataDictionary valueForKey:@"address"] ]Font:[UIFont fontWithName:@"STHeitik-Medium" size:18]];
MTLabel *mtLabel=[MTLabel labelWithTitle:@" "Font:[UIFont fontWithName:@"STHeitik-Medium"size:15]];
[mtLabel setFrame:CGRectMake(0, 0, 255, 105)];
UILabel *shopContent=[[UILabelalloc]initWithFrame:CGRectMake(3, 0, 250, 100)];
shopContent.backgroundColor=[UIColorclearColor];
shopContent.lineBreakMode=UILineBreakModeCharacterWrap;
shopContent.numberOfLines=0;
shopContent.text=[NSStringstringWithFormat:@"%@\n地址:%@\n电话:%@",columnRespData.mNode.nodename, [dataDictionaryvalueForKey:@"address"],[dataDictionaryvalueForKey:@"telphone"]];
shopContent.font=[UIFontfontWithName:@"STHeitik-Medium" size:15];
shopContent.textColor=[UIColorwhiteColor];
[mtLabel addSubview:shopContent];
// [mtLabel setLabelPoint:CGPointMake(-50, 30)];
[an2 addLabel:mtLabel];
NSLog(@"%@",mlatitude.attrvalue);
NSLog(@"%@",mlongitude.attrvalue);
if(mlatitude.attrvalue!=0)
{
}
// [an2 setUserInteractionEnabled:YES];
if([mlatitude.attrvaluefloatValue]!=0&&[mlongitude.attrvaluefloatValue]!=0)
{
[an2 setCoordinate:CGPointMake( [mlongitude.attrvaluefloatValue],[mlatitude.attrvalue floatValue])];
}
[an2 setHotXY:CGPointMake(7, 34.5)];
[mapView addAnnotation:an2 ];
if(j==0)
{
tempLatitude=[mlatitude.attrvaluefloatValue];
tempLongitude=[mlongitude.attrvaluefloatValue];
}
}
}
CGPoint mapcenter=CGPointMake(tempLongitude,tempLatitude);
// CGPoint mapcenter=CGPointMake(116.39716f, 39.91669f);
// CGPoint mapcenter=CGPointMake(LATITUDE, LONGGITUDE);
CGSize mapsize=CGSizeMake(0.04f,0.03f);
CGRect region=CGRectMake(mapcenter.x, mapcenter.y, mapsize.width, mapsize.height);
[mapView setRegion:regionanimated:NO];
[mapView setCenterCoordinate:mapcenteranimated:NO];
[self.viewaddSubview:mapView];
[self.viewsendSubviewToBack:mapView];
[superviewDidLoad];
}
- 打图钉
- map上添加图钉
- GyPSii图钉Hybrid版本升级了,赶紧下载体验吧!
- 窗口始终浮在上面的图钉按钮示例程序(详细编程)
- 【Bing Map学习系列】(5)——如何使用图钉层和地图层
- 【Silverlight】Bing Maps开发应用与技巧二:自定义图钉标注控件和动态ToolPanel
- 【Silverlight】Bing Maps开发应用与技巧二:自定义图钉标注控件和动态ToolPanel
- 【Silverlight】Bing Maps开发应用与技巧二:自定义图钉标注控件和动态ToolPanel
- mapView 生成一个有周围有节奏跳动的圆圈的紫色的信息图钉
- supermap学习系列之silverlight--添加可拖拽的定位图钉(方法一)
- 打豆豆、打豆豆、打豆豆、、、
- 我打我打我打
- 【Silverlight】Bing Maps学习系列(四):使用图钉层(Pushpin layer)及地图图层(MapLayer)
- 【Silverlight】Bing Maps开发应用与技巧五:实现图钉(Pushpin)的可拖放性(Draggable)扩展
- 【Silverlight】Bing Maps开发应用与技巧六:使用样式美化图钉(Pushpin)控件的ToolTip外观
- 【Silverlight】Bing Maps学习系列(四):使用图钉层(Pushpin layer)及地图图层(MapLayer)
- 打豆豆
- 打企鹅
- 新建Oracle数据库
- UItableview 取消选中状态
- 输入法软键盘的显示和隐藏
- 我放弃你!因为你的不珍惜:伤感日志
- Java 数据导出Excel 方法 POI / JXL
- 打图钉
- MFC操作——右键弹出菜单事件
- 使用JMF进行视频、音频的采集与实时传送
- Vmware ESX 5.0 安装与部署 .
- XPath语法在C#中使用XPath示例第二讲
- TableInfo
- HDU 1195 OPEN THE LOCK
- ARM架构
- 【大树下感悟】活着,就是学习思考分享!