Resource Base
Table of contents

DrawingStyleManager

DrawingStyleManager is the class for users to create and adjust DrawingStyles.

  • Objective-C
  • Swift
  1. @interface DrawingStyleManager
    
  2. class DrawingStyleManager : NSObject
    
Method Description
getDrawingStyle Get the DrawingStyle instance with the style ID.
createDrawingStyle Create a user-defined DrawingStyle instance.

 

getDrawingStyle

Get the DrawingStyle instance with the style ID.

  • Objective-C
  • Swift
  1. +(DrawingStyle*)getDrawingStyle:(NSInteger)styleId;
    
  2. class func getDrawingStyle(_ styleId: Int) -> DrawingStyle
    

Parameters

styleId: The ID of the target DrawingStyle.

Return Value

An instance of DrawingStyle.

Code Snippet

  • Objective-C
  • Swift
  1. DrawingStyle* style = [DrawingStyleManager getDrawingStyle:STYLE_BLUE_STROKE_FILL];
    
  2. let style = DrawingStyleManager.getDrawingStyle(STYLE_BLUE_STROKE_FILL)
    

Remarks

There are 8 preset drawing styles.

ID Style Name
1 STYLE_BLUE_STROKE_FILL
2 STYLE_GREEN_STROKE_FILL
3 STYLE_ORANGE_STROKE_FILL
4 STYLE_YELLOW_STROKE_FILL
5 STYLE_BLUE_STROKE_FILL
6 STYLE_GREEN_STROKE_FILL
7 STYLE_ORANGE_STROKE_FILL
8 STYLE_YELLOW_STROKE_FILL

 

createDrawingStyle

Create a user-defined DrawingStyle instance.

  • Objective-C
  • Swift
  1. ```objc +(NSInteger)createDrawingStyle:(UIColor)strokeColor strokeWidth:(CGFloat)strokeWidth fillColor:(UIColor) fillColor textColor:(UIColor) textColor font:(UIFont) font;
2. 
```swift
class func createDrawingStyle(_ strokeColor: UIColor, strokeWidth: CGFloat, fill fillColor: UIColor, textColor: UIColor, font: UIFont) -> Int

Parameters

strokeColor: The stroke colour. strokeWidth: The width of the stroke. fillColor: The fill colour. textColor: The text colour. font: The font style of the text.

Code Snippet

  • Objective-C
  • Swift
  1. UIColor *strokeColour = [UIColor colorWithRed:0.2 green:0.3 blue:0.4 alpha:0.5];
    UIColor *fillColour = [UIColor colorWithRed:0.2 green:0.3 blue:0.4 alpha:0.5];
    UIColor *textColour = [UIColor colorWithRed:0.2 green:0.3 blue:0.4 alpha:0.5];
    UIFont *textFont = [UIFont systemFontOfSize:12.0];
    NSInteger myStyle = [DrawingStyleManager createDrawingStyle:strokeColour strokeWidth:2.0 fillColor:fillColour textColor:textColour font:textFont];
    
  2. let strokeColor = UIColor.init(red: 0.2, green: 0.3, blue: 0.4, alpha: 0.5)
    let fillColour = UIColor.init(red: 0.2, green: 0.3, blue: 0.4, alpha: 0.5)
    let textColor = UIColor.init(red: 0.2, green: 0.3, blue: 0.4, alpha: 0.5)
    let textFont = UIFont.systemFont(ofSize: 12, weight: UIFont.weight.light)
    let myStyleID = DrawingStyleManager.createDrawingStyle(strokeColor, strokeWidth:1, fillColor:fillColor, textColor:textColor, font: textFont)
    

This page is compatible for:

Version 1.0

Is this page helpful?

YesYes NoNo

In this article:

version 3.0.3

  • Latest version
  • Version 4.x
    • Version 4.2.0
    • Version 4.0.2
    • Version 4.0.1
    • Version 4.0.0
  • Version 3.x
    • Version 3.0.3
    • Version 3.0.2
    • Version 3.0.1
    • Version 3.0.0
  • Version 2.x
    • Version 2.3.21
    • Version 2.3.20
    • Version 2.3.12
    • Version 2.3.11
    • Version 2.3.10
    • Version 2.3.5
    • Version 2.3.4
    • Version 2.3.3
    • Version 2.3.2
    • Version 2.3.1
    • Version 2.3.0
    • Version 2.1.4
    • Version 2.1.3
    • Version 2.1.1
    • Version 2.0.0
Change +