实现图片拼接的iOS代码
jopen
10年前
实现将两个图像拼接在一起。在使用前需要添加Framework:CoreGraphics.framework
源码: - (UIImage *) combine:(UIImage*)leftImage :(UIImage*)rightImage { CGFloat width = leftImage.size.width * 2; CGFloat height = leftImage.size.height; CGSize offScreenSize = CGSizeMake(width, height); UIGraphicsBeginImageContext(offScreenSize); CGRect rect = CGRectMake(0, 0, width/2, height); [leftImage drawInRect:rect]; rect.origin.x += width/2; [rightImage drawInRect:rect]; UIImage* imagez = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return imagez; }