- (void)drawRect:(CGRect)rect {

UIBezierPath * path = [UIBezierPath bezierPath];

[path moveToPoint:CGPointMake(fView_Width(self)/2., 6*DX_Proportion)];

[path addLineToPoint:CGPointMake(fView_Width(self) - 6*DX_Proportion, 30/2.*DX_Proportion + 6*DX_Proportion)];

[path addLineToPoint:CGPointMake(fView_Width(self) - 6*DX_Proportion, 90/2.*DX_Proportion + 6*DX_Proportion)];

[path addLineToPoint:CGPointMake(fView_Width(self)/2., fView_Height(self) - 6*DX_Proportion)];

[path addLineToPoint:CGPointMake(6*DX_Proportion, 90/2.*DX_Proportion + 6*DX_Proportion)];

[path addLineToPoint:CGPointMake(6*DX_Proportion, 30/2.*DX_Proportion + 6*DX_Proportion)];

[path closePath];

path.lineWidth = 3*DX_Proportion;

[self.linColor set];

[path stroke];

CAShapeLayer * shapLayer = [CAShapeLayer layer];

shapLayer.path = path.CGPath;

self.imageView.layer.mask = shapLayer;

}

iOS开发 画六边形(多边形)的更多相关文章

  1. iOS开发--画一条黑色的横线

    在网上搜索了下大概有下面几种方法: 1.使用Quartz2D画出横线 需要一个UIVIew把这两个Label装起来,你需要计算好他们的位置同时给黑线预留像素的位置.这样你在UIView里面- (voi ...

  2. 【IOS开发】如何画1像素的线

    最近在项目中画了一根1像素的线,我是通过直接花一个但是通过PS查看,画了不止1个像素. 原代码语句: label1 = [[UILabel alloc] initWithFrame:CGRectMak ...

  3. IOS开发基础知识碎片-导航

    1:IOS开发基础知识--碎片1 a:NSString与NSInteger的互换 b:Objective-c中集合里面不能存放基础类型,比如int string float等,只能把它们转化成对象才可 ...

  4. iOS开发 滤镜的使用

    iOS开发之滤镜的使用技巧(CoreImage)   一.滤镜的内容和效果是比较多并且复杂的 ,学习滤镜需要技巧 如下: 两个输出语句解决滤镜的属性选择问题: 1.查询效果分类中包含什么效果按住com ...

  5. iOS开发 贝塞尔曲线

    iOS开发 贝塞尔曲线UIBezierPath - 陌云 时间 2014-03-14 11:04:00  博客园-所有随笔区 原文  http://www.cnblogs.com/moyunmo/p/ ...

  6. iOS开发---集成百度地图完善版

    一.成为百度的开发者.创建应用 http://developer.baidu.com/map/index.php?title=首页 (鼠标移向 然后选择你的项目需要的功能 你可以在里面了解到你想要使用 ...

  7. iOS开发 - Quartz2D画图

    Quartz 2D简单介绍 是一个二维画图引擎,同一时候支持iOS和Mac系统 Quartz 2D能完毕的工作 绘制图形 : 线条\三角形\矩形\圆\弧等 绘制文字 绘制\生成图片(图像) 读取\生成 ...

  8. iOS开发之再探多线程编程:Grand Central Dispatch详解

    Swift3.0相关代码已在github上更新.之前关于iOS开发多线程的内容发布过一篇博客,其中介绍了NSThread.操作队列以及GCD,介绍的不够深入.今天就以GCD为主题来全面的总结一下GCD ...

  9. iOS 开发不可缺少的工具

    1.截屏利器:Snip 强大的滚动截屏功能,你值得拥有! Snip.png 传送门:http://www.snip.qq.com/ 2.Mac上最好的终端模拟器:iTerm2 iTeam.png 传送 ...

随机推荐

  1. 利用Velocity结合Spring发email

    在spring中发mail是一件容易的事,如果利用Velocity做mail的模板来发送就更得心应手了. 首先,还是简单描述sping中的配置,发mail需要一个mail的engin: <bea ...

  2. Codeforces Round #372 (Div. 2) C

    Description ZS the Coder is playing a game. There is a number displayed on the screen and there are ...

  3. ViewState

    ViewState就像一个记录本,由于WebFormd的无状态性,刷新了页面.那么这个页面就和上一个页面没有任何关系了.为了使刷新前的页面和本页面产生联系,ViewState的作用就是记录刷新前页面的 ...

  4. 监控windows服务,当服务停止后自动重启服务

    近期花时间研究了一下windows和linux下某服务停了后自动重启的功能,在网上收集了些资料,并经过测试,在此整理一下.这里介绍的是windows服务的监控,是通过批处理来实现的.本例是监控wind ...

  5. ActiveMQ点对点的消息发送案例

    公司最近会用MQ对某些业务进行处理,所以,这次我下载了apache-activemq-5.12.0-bin把玩下. 基于练习方便需要,使用Windows的版本. 参考的优秀文章: activemq的几 ...

  6. SGU 105 div.3 找规律

    There is sequence 1, 12, 123, 1234, ..., 12345678910, ... . Given first N elements of that sequence. ...

  7. CodeForces 651B Beautiful Paintings 贪心

    A. Joysticks time limit per test 1 second memory limit per test 256 megabytes input standard input o ...

  8. 4.给定一个正整数m,统计m的位数,分别打印每一位数字,再按照逆序打印出各位数字。 要求:m定义为类的属性,需定义构造函数为m赋值;当m大于99999时,输出错误信息“the number is too large”,不再执行。

    package a; public class ShuZi { int m; public int getM() { return m; } public void setM(int m) { thi ...

  9. ASP.NET API盘点

    1.控制只返回JSON一种数据 public class JsonContentNegotiator : IContentNegotiator { private readonly JsonMedia ...

  10. How to evaluate a transimpedance amplifier (part 2)

    In my previous blog on "How to evaluate a transimpedance amplifier, part 1", we looked at ...