-(void)viewDidLoad
{
//1.1背景图片
UIImage *bgImage [UIImage imageNamed:@"new"];
CGFloat w = bgImage.size.width;
CGFloat h = bgImage.size.width;
//1.创建图形上下文
UIGraphicsBeginImageContextWithOptions(bgImage.size,NO,0.0);
//1.2.画图
[bgImage drawInRect:CGRectMake(0,0,w,h)];
//2.创建水印图片
UIImage *iconImage = [UIImage imageNamed:@"logo"];
CGFloat iconW = iconImage.size.width * 0.2;
CGFloat iconH = iconImage.size.height *0.2;
CGFloat iconX = w - iconW - 5;
CGFloat iconY = h - iconH - 5;
//2.1画图
[iconImage drawInRect:CGRectMake(iconX,iconY,iconW,iocnH)];
//3.获取当前的图片
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
//4.结束图形
UIGraphicsEndImageContext();
self.imageView.image = newImage;
//5.打印
NSData *data = UIImagePNGRepresentation(newImage);
[data writeToFile:@"/User/apple/DeskTop/new.png" atomically:YES];
}