android 百度地图大头针,百度地图自定义大头针&&大头针

百度地图自定义大头针&&大头针

查看次数: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上下载。

收藏

分享到:

效果图

08245be32bb80a2018d2709a3683af46.png

我来说两句

217bd9aafe88004693c2708440fd79e2.png

发表评论

您还没有登录!请登录或注册

所有评论(0)

更多评论

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值