Initializer

init(roundedRect:byRoundingCorners:cornerRadii:)

Creates and returns a new UIBezierPath object initialized with a rounded rectangular path.

Declaration

convenience init(roundedRect rect: CGRect, byRoundingCorners corners: UIRectCorner, cornerRadii: CGSize)

Parameters

rect

The rectangle that defines the basic shape of the path.

corners

A bitmask value that identifies the corners that you want rounded. You can use this parameter to round only a subset of the corners of the rectangle.

cornerRadii

The radius of each corner oval. Values larger than half the rectangle’s width or height are clamped appropriately to half the width or height.

Return Value

A new path object with the rounded rectangular path.

Discussion

This method creates a closed subpath, proceeding in a clockwise direction (relative to the default coordinate system) as it creates the necessary line and curve segments.

See Also

Creating a UIBezierPath Object

init(rect: CGRect)

Creates and returns a new UIBezierPath object initialized with a rectangular path.

init(ovalIn: CGRect)

Creates and returns a new UIBezierPath object initialized with an oval path inscribed in the specified rectangle

init(roundedRect: CGRect, cornerRadius: CGFloat)

Creates and returns a new UIBezierPath object initialized with a rounded rectangular path.

init(arcCenter: CGPoint, radius: CGFloat, startAngle: CGFloat, endAngle: CGFloat, clockwise: Bool)

Creates and returns a new UIBezierPath object initialized with an arc of a circle.

init(cgPath: CGPath)

Creates and returns a new UIBezierPath object initialized with the contents of a Core Graphics path.

func reversing() -> UIBezierPath

Creates and returns a new Bézier path object with the reversed contents of the current path.

init()

Creates and returns an empty path object.