- (void) createlogoimage {Nsarray*filter =[Cifilter Filternamesincategory:kcicategorybuiltin]; NSLog (@"%@", filter); //Two-dimensional code filterCifilter *filterimage = [Cifilter filterwithname:@"Ciqrcodegenerator"]; //set the two-bit code filter as the default property[Filterimage SetDefaults]; //turn text into binaryNSData *dataimage = [@"Mafeng"datausingencoding:nsutf8stringencoding]; //Print the input propertiesNSLog (@"%@", Filterimage.inputkeys); //KVC Assignment Value[Filterimage setvalue:dataimage Forkey:@"InputMessage"]; //Remove the output imageCiimage *outputimage =[Filterimage Outputimage]; Outputimage= [Outputimage Imagebyapplyingtransform:cgaffinetransformmakescale ( -, -)]; //Convert PicturesUIImage *image =[UIImage Imagewithciimage:outputimage]; //Add a custom image to a two-dimensional code//open drawing, get picture context < picture size >Uigraphicsbeginimagecontext (image.size); //Picture The two-dimensional code .[Image Drawinrect:cgrectmake (0,0, Image.size.width, Image.size.height)]; //draw the small picture upUIImage *smallimage = [UIImage imagenamed:@"123.jpg"]; [Smallimage drawinrect:cgrectmake (Image.size.width- -) /2, (Image.size.width- -) /2, -, -)]; //get the final pictureUIImage *finalimage =Uigraphicsgetimagefromcurrentimagecontext (); //Close ContextUigraphicsendimagecontext (); //ShowSelf.imageview.image =Finalimage; }
IOS-Create a logo QR code