贝塞尔曲线学习(1)

来源:互联网 发布:开源 流量统计 软件 编辑:程序博客网 时间:2024/06/05 19:12

简单的连线(在drawRect方法中)

- (void)drawRect:(CGRect)rect{    // 设置颜色    UIColor *color = [UIColor orangeColor];    [color set];    // 取一个贝塞尔曲线实例    UIBezierPath *aPath = [UIBezierPath bezierPath];    aPath.lineWidth = 5.0f;// 线宽        aPath.lineCapStyle = kCGLineCapRound;// 线条拐角用什么样式,<span style="font-family: Arial, Helvetica, sans-serif;">kCGLineCapRound</span><span style="font-family: Arial, Helvetica, sans-serif;">这个是用圆</span>    aPath.lineJoinStyle = <span style="font-family: Arial, Helvetica, sans-serif;">kCGLineJoinRound</span><span style="font-family: Arial, Helvetica, sans-serif;">;// 终点用什么样式 同上</span>        [aPath moveToPoint:CGPointMake(100, 100)];// 起始点    [aPath addLineToPoint:CGPointMake(150, 150)];// 其他点    [aPath addLineToPoint:CGPointMake(100, 150)];    [aPath closePath];    //    [aPath stroke];  连接每个点    [aPath fill];// 链接   }


可以绘制多个图形,只要新建另一个贝塞尔曲线就行



0 0
原创粉丝点击