怎样将图片1、图片2合成一张新的图片

dispatch_group_notify(group, queue, ^{

// 1.开启新的图形上下文

UIGraphicsBeginImageContext(CGSizeMake(100, 100));

// 2.绘制图片

[self.image1 drawInRect:CGRectMake(0, 0, 50, 100)];

[self.image2 drawInRect:CGRectMake(50, 0, 50, 100)];

// 3.取得上下文中的图片

UIImage *image = UIGraphicsGetImageFromCurrentImageContext();

// 4.结束上下文

UIGraphicsEndImageContext();

// 回到主线程显示图片

 dispatch_async(dispatch_get_main_queue(), ^{

      // 将新图片显示出来 

          self.imageView.image = image;

  });

 });

原文地址:https://www.cnblogs.com/wangliang2015/p/5428862.html