Most efficient way to draw part of an image in iOS

后端 未结 5 1995
灰色年华
灰色年华 2020-12-04 06:35

Given an UIImage and a CGRect, what is the most efficient way (in memory and time) to draw the part of the image corresponding to the CGRect<

5条回答
  •  我在风中等你
    2020-12-04 06:57

    Rather than creating a new image (which is costly because it allocates memory), how about using CGContextClipToRect?

提交回复
热议问题