Inherits from NSObject
Conforms to NSCopying
TKDrawing
Declared in TKStroke.h

Overview

Represents a stroke that renders a line.

Properties

allowsAntialiasing

Determines whether to use antialiasing when drawing the stroke

@property (nonatomic, assign) BOOL allowsAntialiasing

Declared In

TKStroke.h

color

The stroke color.

@property (nonatomic, strong, nullable) UIColor *color

Declared In

TKStroke.h

cornerRadius

The radius to use when drawing rounded corners. The Default is 0.

@property (nonatomic, assign) CGFloat cornerRadius

Declared In

TKStroke.h

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. The default is all corners. Ignored if cornerRadius is 0.

@property (nonatomic, assign) UIRectCorner corners

Declared In

TKStroke.h

dashPattern

The dash patterns of the stroke. An array of NSNumber that specify the lengths of the painted segments and unpainted segments, respectively, of the dash pattern, or nil for no dash pattern. For example, passing an array with values [@2, @3] sets a dash pattern that alternates between a 2-user-space-unit-long painted segment and a 3-user-space-unit-long unpainted segment. Passing values [@1, @3, @4, @2] sets the pattern to a 1-unit painted segment, a 3-unit unpainted segment, a 4-unit painted segment, and a 2-unit unpainted segment.

@property (nonatomic, strong, nullable) NSArray *dashPattern

Declared In

TKStroke.h

fill

The stroke’s brush.

@property (nonatomic, strong, nullable) TKFill *fill

Declared In

TKStroke.h

insets

Edge insets to apply. This property has no effect when using drawInContext:withPath: method.

@property (nonatomic, assign) UIEdgeInsets insets

Declared In

TKStroke.h

lineCap

Line cap style.

@property (nonatomic, assign) CGLineCap lineCap

Declared In

TKStroke.h

lineJoin

Line join style.

@property (nonatomic, assign) CGLineJoin lineJoin

Declared In

TKStroke.h

miterLimit

Line miter limit.

@property (nonatomic, assign) CGFloat miterLimit

Declared In

TKStroke.h

phase

A value that specifies how far into the dash pattern the line starts, in units of the user space. For example, passing a value of 3 means the line is drawn with the dash pattern starting at three units from its beginning. Passing a value of 0 draws a line starting at the beginning of the dash pattern.

@property (nonatomic, assign) CGFloat phase

Declared In

TKStroke.h

shadowBlur

The shadow blur.

@property (nonatomic) CGFloat shadowBlur

Declared In

TKStroke.h

shadowColor

The shadow color.

@property (nonatomic, strong, nullable) UIColor *shadowColor

Declared In

TKStroke.h

shadowOffset

The shadow offset

@property (nonatomic) CGSize shadowOffset

Declared In

TKStroke.h

strokeSides

The sides of the stroke to draw. The default is all sides.

@property (nonatomic, assign) TKRectSide strokeSides

Discussion

The rectangle sides are defined as follows:

typedef enum {
    TKRectSideTop = 1 << 0,     // Draw stroke on top side.
    TKRectSideBottom = 1 << 1,  // Draw stroke on bottom side.
    TKRectSideLeft = 1 << 2,    // Draw stroke on left side.
    TKRectSideRight = 1 << 3,   // Draw stroke on right side.
    TKRectSideAll = ~0UL        // Draw stroke on all sides (default)
} TKRectSide;

Declared In

TKStroke.h

width

The stroke’s width.

@property (nonatomic, assign) CGFloat width

Declared In

TKStroke.h

Class Methods

strokeWithColor:

Defines the stroke with a solid color.

+ (instancetype __nonnull)strokeWithColor:(UIColor *__nonnull)color

Parameters

color

The solid color.

Declared In

TKStroke.h

strokeWithColor:width:

Defines the stroke with a solid color and thickness.

+ (instancetype __nonnull)strokeWithColor:(UIColor *__nonnull)color width:(CGFloat)width

Parameters

color

The solid color.

width

The stroke’s thickness.

Declared In

TKStroke.h

strokeWithColor:width:cornerRadius:

Defines the stroke with a solid color, thickness and corner radius.

+ (instancetype __nonnull)strokeWithColor:(UIColor *__nonnull)color width:(CGFloat)width cornerRadius:(CGFloat)cornerRadius

Parameters

color

The solid color.

width

The stroke’s tickness.

cornerRadius

The corner radius in points.

Declared In

TKStroke.h

strokeWithFill:

Defines the stroke with a fill.

+ (instancetype __nonnull)strokeWithFill:(TKFill *__nonnull)fill

Parameters

fill

The fill used for the stroke.

Declared In

TKStroke.h

strokeWithFill:width:

Defines the stroke with a fill and thickness.

+ (instancetype __nonnull)strokeWithFill:(TKFill *__nonnull)fill width:(CGFloat)width

Parameters

fill

The fill used for the stroke.

width

The stroke’s thickness.

Declared In

TKStroke.h

strokeWithFill:width:cornerRadius:

Defines the stroke with a fill, thickness and corder radius.

+ (instancetype __nonnull)strokeWithFill:(TKFill *__nonnull)fill width:(CGFloat)width cornerRadius:(CGFloat)cornerRadius

Parameters

fill

The fill used for the stroke.

width

The stroke’s thickness.

cornerRadius

The corner radius in points.

Declared In

TKStroke.h

Instance Methods

initWithColor:

Defines the stroke with a solid color.

- (instancetype __nonnull)initWithColor:(UIColor *__nonnull)color

Parameters

color

The solid color.

Declared In

TKStroke.h

initWithColor:width:

Defines the stroke with a solid color and thickness.

- (instancetype __nonnull)initWithColor:(UIColor *__nonnull)color width:(CGFloat)width

Parameters

color

The solid color

width

The stroke’s thickness.

Declared In

TKStroke.h

initWithFill:

Initializes the stroke with a fill.

- (instancetype __nonnull)initWithFill:(TKFill *__nonnull)fill

Parameters

fill

The fill used for the stroke.

Declared In

TKStroke.h

initWithFill:width:

Initializes the stroke with a fill and thickness.

- (instancetype __nonnull)initWithFill:(TKFill *__nonnull)fill width:(CGFloat)width

Parameters

fill

The fill used for the stroke.

width

The stroke’s thickness.

Declared In

TKStroke.h