//生成二维码
- (void)createCIImageWithText:(NSString*)text
{
CIFilter*filter = [CIFilterfilterWithName:@"CIQRCodeGenerator"];
NSString*string = text;
NSData*data = [stringdataUsingEncoding:NSUTF8StringEncoding];
//2.通过kVO设置滤镜传入数据
[filtersetValue:dataforKey:@"inputMessage"];
//3.生成二维码
CIImage*iconImage = [filteroutputImage];
UIImageView*tempImageView = [[UIImageViewalloc]initWithFrame:(CGRectMake(50,50,100,100))];
UIImage*image = [UIImageimageWithCIImage:iconImage];
tempImageView.image= image;
[self.viewaddSubview:tempImageView];
}
网友评论