且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

iPhone:沿曲线绘制对象

更新时间:2023-02-02 17:36:44

您可以使用Path /Reference.html rel = nofollow noreferrer> UIBezierPath 或 CGPath 。前者是Objective-C,后者是纯C。我建议使用UIBezierPath,因为它更易于使用。

As an alternative to Android's Path, you can use either UIBezierPath or CGPath. The former is Objective-C, the later pure C. I recommend going with UIBezierPath as it's easier to use.

要旋转视图,请使用 transform 属性(请参见此问题有关如何使用它的示例)。但是请注意,然后您需要忽略框架(未定义),并需要通过修改 center

To rotate a view, use the transform property of UIView (see this question for an example on how to use it). But note that you then need to ignore the frame (it's undefined) and need to move the view by modifying the center instead.