一、图片的切分
CGImageRef image[10];
for (int i = 0; i < 10; i++) {
CGRect rect;
rect.origin.x = fWidth * i;
rect.origin.y = 0;
rect.size.width = fWidth;
rect.size.height = fHeight;
imageNum[i] = CGImageCreateWithImageInRect([image CGImage], rect);
}
二、图片的合并
UIGraphicsBeginImageContextWithOptions(self.bounds.size);
UIImage* image1 = [UIImage imageNamed:@"x1.png"];
UIImage* image2 = [UIImage imageNamed:@"x2.png"];
[image1 drawInRect:rect1];
[image2 drawInRect:rect2];
UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();