Graphic and drawing cases in iOS development applications

Source: Internet
Author: User

IOS developmentGraph andDrawThe case study is the content to be introduced in this article, mainly to learnIOS developmentSome details about the drawing, otherwise it will not be able to achieve the effect. For details, refer to the details.

1. iOS supports OpenGL ES and Quartz/UIKit/CoreAnimationDrawInterface. UIKitDrawMust be completed in the main thread.

2. Quartz supports path-based rendering, reverse sampling, filling, image coloring, coordinate transformation, pdf rendering, display parsing, and other functions.

3. UIKit supports line drawing, image and color operations.

4. Core Animation supports Animation rendering.

5. Use DrawRect to draw a View. The following actions are triggered:

1) Move and block a View.

2) Hide and display a View.

3) drag the View.

4) display call setNeedDisplay and setNeedDispalyRect

6. the upper-left corner of UIKit is the origin and the lower-right corner is the destination. CoreAnimation is the origin, and the top right corner is the destination. Use CGContextRotateCTM, CGContextScaleCTM, and CGContextTranslateCTM to change the matrix, or directly use CGAffineTransform to set the transformation matrix.

7. CGContext: You can create different context types for Bitmap and PDF.

1) transformation matrix

2) Crop range

3) Line Drawing attributes

4) curve Accuracy

5) reverse sampling

6) Fill attributes and stroke attributes

7) translucent Properties

8) Color Space

9) Text

10) Color Mixing Mode

8. Use UIGraphicsGetCurrentContext to obtain the current CGContext.

9,

 
 
  1. Uigraphicsbeginimagecontextwitexceptions and UIGraphicsEndImageContext

The code used to contain image rendering.

 
 
  1. Uigraphicsbegin1_contexttofiletodata) and uigraphicsend1_context

Used to include the Code drawn in PDF.

10. Draw the Path, that is, draw the vector. We recommend that you use UIBezierPath, followed by CGPath.

11. Flip screen conversion:

 
 
  1. CGContextTranslateCTM(graphicsContext, 0.0, drawingRect.size.height);   
  2. CGContextScaleCTM(graphicsContext, 1.0, -1.0);  

12. Point is usually equal to Pixel, but one Point can be specified to correspond to multiple Pixel.

13. Use UIColor to change the color space.

14. rendering performance:

1) Minimize the number of draw calls

2) Try to use an opaque View

3) Reuse views and tables during screen scrolling

4) You do not need to clear the result of the last painting when you scroll the screen.

5) ReduceDrawStatus switch.

Summary:IOS developmentGraph andDrawI hope this article will be helpful to you!

Related Article

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.