介绍两种画直线的方法:
(1)通过QuartzCore
(2)通过UIBezierPath
先创建一个自定义view:
然后在导入QuartzCore框架:
然后在m文件打出下面代码,三种函数都是同样的效果:
#import "ZCView.h"
#import <QuartzCore/QuartzCore.h>
@implementation ZCView
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
*/
- (void)drawRect:(CGRect)r
版权声明:本文为zhaolaoda2012原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。