Objective C开发

画带图片的高清二维码

2018-01-12  本文已影响4人  Jimsir

// _qrImg = [UIImage imageWithCIImage:image];
// 4. 显示二维码
_qrImg = [self createNonInterpolatedUIImageFormCIImage:image withSize:200];

//画图
UIGraphicsBeginImageContextWithOptions(_qrImg.size,NO,0.0);
[_qrImg drawInRect:CGRectMake(0, 0, _qrImg.size.width, _qrImg.size.height)];
UIImage *smallImage = [UIImage imageNamed:@"centerImg"];
[smallImage drawInRect:CGRectMake((_qrImg.size.width-KRate(50))/2, (_qrImg.size.width - KRate(50))/2, KRate(50), KRate(50))];
UIImage * finalImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

_qrImg = finalImage;

self.imageView.image = _qrImg;

}

上一篇下一篇

猜你喜欢

热点阅读