如何在iOS中使用Bezier路径制作星形? [英] How to make star shape with bezier path in ios?

查看:63
本文介绍了如何在iOS中使用Bezier路径制作星形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Bezier路径,并使用它制作简单的形状。使用贝塞尔曲线路径制作星形的过程是什么?

I am working with Bezier path and making simple shapes with it. What is the process for making a star shape using Bezier paths?

推荐答案

尝试以下路径:

//// Star Drawing
UIBezierPath* starPath = [UIBezierPath bezierPath];
[starPath moveToPoint: CGPointMake(45.25, 0)];
[starPath addLineToPoint: CGPointMake(61.13, 23)];
[starPath addLineToPoint: CGPointMake(88.29, 30.75)];
[starPath addLineToPoint: CGPointMake(70.95, 52.71)];
[starPath addLineToPoint: CGPointMake(71.85, 80.5)];
[starPath addLineToPoint: CGPointMake(45.25, 71.07)];
[starPath addLineToPoint: CGPointMake(18.65, 80.5)];
[starPath addLineToPoint: CGPointMake(19.55, 52.71)];
[starPath addLineToPoint: CGPointMake(2.21, 30.75)];
[starPath addLineToPoint: CGPointMake(29.37, 23)];
[starPath closePath];
[UIColor.redColor setStroke];
starPath.lineWidth = 1;
[starPath stroke];

您可以使用绘画代码应用程序来为iOS和OSX绘制形状。
这是易于使用且非常有用的应用程序。

You can use Paint Code app to draw shape for iOS and OSX. This is easy to use and very helpful app.

快乐编码。

这篇关于如何在iOS中使用Bezier路径制作星形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆