百度地图自定义大头针&&大头针
查看次数:6802
下载次数:938
上传时间:2016-08-01
大小:491 B
# YWLJMapView
利用百度地图实现自定义大头针和气泡
###自定义大头针
----------------------------------------------------------
效果图:---->没错就是链家
![001.png](http://upload-images.jianshu.io/upload_images/1488651-acd22675f5000f79.png?imageMogr2/auto-orient/strip|imageView2/2/w/1240)
----------------------------------------------------------
```
//背景色
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上下载。
收藏
分享到:
效果图
我来说两句
发表评论
您还没有登录!请登录或注册
所有评论(0)
更多评论