In iOS, when drawing operations, it is generally called in Uiview:drawrect
uigraphicsbeginimagecontextwithoptions, such as a series of functions, sometimes direct drawing on the line, such as UIImage drawrect, and so on, sometimes need to carry out a slightly complex operation, such as color mixing, mask, etc., A CTM transformationof the cgcontextref is required to understand that thecoordinate system of the uikit and quartz plots is not the same, the original point is the top left and the latter is the lower left. If you call the drawing context Cgcontextref directly using the Uikit method, the coordinate system is automatically adjusted, and the quartz is consistent, and the coordinate system is not required to perform a series of operations through the methods in the Uikit.framework. If you need to use coregraphics.framework functions, such as cgcontextdrawimage, you need to manually adjust the coordinate system, because the mapping coordinate system is inconsistent. In other words, when calling Uikit.framework, you can use the coordinate system, but you need to pay attention when calling Coregraphics.framework. Please specify the wrong place.
coordinate processing for iOS drawings