Skip to content

UIBezierPath() constructor ​

The UIBezierPath() constructor creates an empty path. The path has no segments; add them afterward with moveToPoint() and the drawing methods.

Rectangles, ovals, rounded rectangles, and arcs have ready-made static methods; see UIBezierPath.

Syntax ​

new UIBezierPath()

Parameters ​

None.

Return value ​

A new UIBezierPath. Its isEmpty is true and its currentPoint is CGPoint(0, 0).

Exceptions ​

None.

Examples ​

js
const path = new UIBezierPath();
console.log(path.isEmpty);
path.moveToPoint(new CGPoint(0, 60));
path.addLineToPoint(new CGPoint(40, 20));
console.log(path.isEmpty);

Result: The console prints true and then false.

Corresponding iOS API ​

[UIBezierPath bezierPath], or [[UIBezierPath alloc] init].

See also ​