百度地图自定义大头针&&大头针
查看次数:6593
下载次数:923
上传时间:2016-08-01
大小:491 B
# YWLJMapView
利用百度地图实现自定义大头针和气泡
###自定义大头针
----------------------------------------------------------
效果图:---->没错就是链家

----------------------------------------------------------
```
//背景色
CGRect rect = _contentView.bounds;
//创建Path -->类似于对话框气泡路径实现
CGMutablePathRef layerpath = CGPathCreateMutable();
CGPathMoveToPoint(layerpath, NULL, 0, 0);
CGPathAddLineToPoint(layerpath, NULL, CGRectGetMaxX(rect), 0);
CGPathAddLineToPoint(layerpath, NULL, CGRectGetMaxX(rect), CGRectGetMaxY(rect));
CGPathAddLineToPoint(layerpath, NULL, 45, CGRectGetMaxY(rect));
CGPathAddLineToPoint(layerpath, NULL, 37.5, CGRectGetMaxY(rect)+5);
CGPathAddLineToPoint(layerpath, NULL, 30, CGRectGetMaxY(rect));
CGPathAddLineToPoint(layerpath, NULL, 0, CGRectGetMaxY(rect));
CAShapeLayer *shapelayer=[CAShapeLayer layer];
UIBezierPath *path=[ UIBezierPath bezierPathWithCGPath:layerpath];
shapelayer.path=path.CGPath;
shapelayer.fillColor=[ UIColor colorWithRed:83/255.0 green:180/255.0 blue:119/255.0 alpha:1.0].CGColor;
shapelayer.cornerRadius=5;
[_contentView.layer addSublayer:shapelayer];
```
----------------------------------------------------------
demo传送门[这里](https://github.com/Mr-yuwei/YWLJMapView)
注意下载的demo需要自己重新编辑一下,因为pod文件太大,上传有限制,欢迎到git上下载。
收藏