Bézier curve (Uibezierpath) Properties, method totals

Source: Internet
Author: User
Tags dashed line

The properties of Uibezierpath are described in:

1.cgpath: Convert the Uibezierpath class to Cgpath, similar to Uicolor's Cgcolor

2.empty: Read-only type, whether there are valid elements on the path

3.bounds: Unlike the view's bounds, it gets the x-coordinate, y-coordinate, and width of path, but the height is 0

4.Currentpoint: The location of the current path, which can be understood as the end of path

5.linewidth:path width

6.Linecapstyle:path End style with 3 styles

Kcglinecapbutt: no point

Kcglinecapround: Round End

Kcglinecapsquare: Square ends (style and Kcglinecapbutt are the same, but a little longer than Kcglinecapbutt)

    

7.Linejoinstyle: Corner style

kcglinejoinmiter: Sharp Corner

Kcglinejoinround: Rounded Corners

Kcglinejoinbevel: Lack of angle

    

   

8.miterlimit: Maximum miter length (only valid with Kcglinejoinmiter), the smaller the angle of the corner, the greater the miter length

To avoid too long miter lengths, use the Linelimit property limit, and if the miter length exceeds miterlimit, the corner is displayed as a kcalinejoinbevel type

9.flatness: Curved path rendering accuracy, default is 0.6, the smaller the higher the accuracy, the corresponding more consumption performance.

Usesevenoddfillrule: Whether a single-ring rule is used to draw a path, the default is No.

Uirectcorner: Pt .

Uirectcornertopleft: Upper left corner

Uirectcornertopright: Upper right corner

  Uirectcornerbottomleft: Lower left corner

  Uirectcornerbottomright: Lower right corner

  Uirectcornerallcorners: all Four Corners

Introduction to Uibezierpath Method:

1. Create the Uibezierpath object:

+ (instancetype) Bezierpath:

2. Create a rectangle within a rect:

+ (instancetype) Bezierpathwithrect: (cgrect) Rect:

Parameter:rect-> Rectangle frame

3. Create the inscribed curve in RECT:

+ (instancetype) Bezierpathwithovalinrect: (cgrect) Rect:

Parameter:rect-> Rectangle frame

4. Create a rectangle with rounded corners, which will no longer work when the rectangle becomes a positive circle:

+ (instancetype) Bezierpathwithroundedrect: (cgrect) rect cornerradius: (cgfloat) Cornerradius

Parameter:rect-> Rectangle frame

Cornerradius-> Round Corner size

5. Set specific rectangles with rounded corners:

+ (instancetype) Bezierpathwithroundedrect: (cgrect) rect byroundingcorners: (Uirectcorner ) Corners cornerradii: (cgsize) cornerradii

Parameter:rect-> Rectangle frame

Corners-> The specified rounded corners

cornerradii-> size of rounded corners

6. Create arc + (instancetype) Bezierpathwitharccenter: (cgpoint) Center radius: (cgfloat ) Radius startangle: (cgfloat) startangle endangle: (cgfloat) endangle clockwise: (BOOL) Clockwise

Parameter:center-> dot

radius-> radius

startangle-> Start Position

until the end of endangle->

Clockwise-> whether the clockwise direction

Starting position reference diagram:

      

7. Create a path from an existing path:

  B+ (instancetype) Bezierpathwithcgpath: (cgpathref) cgpath

Parameter:cgpath-> an existing path

8.init Method:

-(instancetype) init

9.initWiteCoder Method:

-(nullable instancetype) Initwithcoder: (nscoder *) adecoder

10. Convert to Cgpath:

-(cgpathref) Cgpath

11. Move to a point:

-(void) moveToPoint: (cgpoint) Point

Parameter:point-> target Location

12. Draw a line:

  -(void) Addlinetopoint: (cgpoint) Point

Parameter:point-> target Location

13. Create a three-time Bezier curve:

-(void) Addcurvetopoint: (cgpoint) endPoint controlPoint1: (cgpoint) controlPoint1 ControlPoint2: (cgpoint) controlPoint2

Parameter:endpoint-> end point

Controlpoint1-> Control point 1

Controlpoint2-> Control point 2

Reference graph:

    

14. Create a two-time Bezier curve:

-(void) Addquadcurvetopoint: (cgpoint) endPoint controlpoint: (cgpoint) controlpoint

Parameter:endpoint-> end point

Controlpoint-> Control Point

Reference graph:

     

15. Add an arc:

-(void) Addarcwithcenter: (cgpoint) Center radius: (cgfloat) Radius startangle: (cgfloat ) startangle endangle: (cgfloat) endangle clockwise: (BOOL) clockwise

Parameters: See Creating arcs

16. Close the path, i.e. a line at the end point and starting point:

-(void) Closepath;

17. Clear the Path:

-(void) removeallpoints;

18. Append Path:

-(void) Appendpath: (uibezierpath *) bezierpath

Parameter:bezierpath-> the appended path

19. Twist the path, where the starting point becomes the end point and the end becomes the beginning:

-(uibezierpath *) Bezierpathbyreversingpath

20. The path is affine transformed:

-(void) Applytransform: (cgaffinetransform) transform;

Parametric:transform-> affine transformation

21. Draw the dashed line:

-(void) Setlinedash: (nullable const cgfloat *) pattern count: (nsinteger) Count phase: (cgfloat) phase

Parameter:pattern->C type linear data

number of data in count-> pattern

phase-> Start Position

22. Fill:

-(void) fill

23. Stroke, path creation requires a stroke to display:

-(void) stroke;

24. To set the stroke color, you need to call the stroke method after setting:

[[Uicolor Blackcolor] setstroke];

25. Set the fill color, you need to call the Fill method after setting

[[Uicolor Redcolor] setfill];

26. Set the blending mode of the stroke:

-(void) Fillwithblendmode: (cgblendmode) Blendmode Alpha: (cgfloat) Alpha

Parameter:blendmode-> blending mode

alpha-> Transparency

27. Set the blending mode for the fill:

-(void) Strokewithblendmode: (cgblendmode) Blendmode Alpha: (cgfloat) Alpha;

  Parameter:blendmode-> blending mode

alpha-> Transparency

28. The drawing area that modifies the current drawing context is visible, and subsequent drawing operations cause the rendered content to occur only in the populated area of the specified path

-(void) Addclip;

This article reprinted to: Http://www.cnblogs.com/small-octopus/p/4874600.html

Bézier curve (Uibezierpath) Properties, method totals

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.