标签:cga imp end interface nat image click transform cal
#import "ViewController.h"
@interface ViewController ()
// 用于显示生成二维码图片的 imageView
@property (weak, nonatomic) IBOutlet UIImageView *imageView;
@end
@implementation ViewController
// 点击生成二维码
- (IBAction)click {
//创建滤镜
CIFilter *filter = [CIFilter filterWithName:@"CIQRCodeGenerator"];
//设置默认值
[filter setDefaults];
//设置内容
[filter setValue:[@"https://www.baidu.com" dataUsingEncoding:NSUTF8StringEncoding] forKey:@"inputMessage"];
//生成图片
CIImage *image = [filter outputImage];
//放大图片
image = [image imageByApplyingTransform:CGAffineTransformMakeScale(8, 8)];
//显示二维码图片
self.imageView.image = [UIImage imageWithCIImage:image];
}
@end
标签:cga imp end interface nat image click transform cal
原文地址:http://www.cnblogs.com/chenweb/p/7633261.html