找到你要的答案

Q:Draw on a part of a context?

Q:画一个上下文的一部分?

Is it possible by using UIGraphicsBeginImageContext to draw CGImage in a region of image context of my CGImage?

Example: I have image context 100x100 and i want to draw CGImage in a coordinates (x:4, y:0) and with width 50. I'm trying to do it by

CGContextDrawImage(fullContext, CGRect(x: 4, y: 0, width: 50,     
height: size.height), tiledBackground.CGImage);

But device always draws tiledBackground.CGImage from (4.0) till (100,0) repeating CGImage ignoring my width argument.

利用uigraphicsbeginimagecontext在我cgimage图像背景区域画cgimage是可能的吗?

Example: I have image context 100x100 and i want to draw CGImage in a coordinates (x:4, y:0) and with width 50. I'm trying to do it by

CGContextDrawImage(fullContext, CGRect(x: 4, y: 0, width: 50,     
height: size.height), tiledBackground.CGImage);

但设备总是吸引tiledbackground.cgimage从(4)至(100,0)重复cgimage无视我的宽度参数。

ios  swift  cocoa-touch  cgcontext