In iOS development, you can generate QR codes for your own code, and you need to use a framework Coreimage
Coreimage frame can make filters, GIF motion diagram, QR code, etc.
Look first.
The following code is directly attached (OC is the same process as below)
1 func Createqrcode () {2 3 //Create a filter4Let Qrfilter = Cifilter (name:"Ciqrcodegenerator")5 //Reset the initial value of the filter6 qrfilter.setdefaults ()7 //set the contents of the filter via KVC (you need to convert the string into binary data)8Qrfilter.setvalue ("I'm a QR code .". datausingencoding (nsutf8stringencoding, Allowlossyconversion:true), Forkey:"InputMessage")9 //output Image (note that the resulting QR code size is about 23*23, not clear)TenLet Ciimage =Qrfilter.outputimage One A - //further processing, using another filter--monochrome, deformation filter -Let Colorfilter = Cifilter (name:"Cifalsecolor") the //Reset the initial value of the filter - colorfilter.setdefaults () - //start processing unclear pictures -Colorfilter.setvalue (Ciimage, Forkey:"Inputimage") + //Set foreground color (note only with Cicolor, use Uicolor will collapse) -Colorfilter.setvalue (Cicolor (red:0, Green:0, Blue:0), Forkey:"InputColor0") + //Set Background color AColorfilter.setvalue (Cicolor (red:1, Green:1, Blue:1), Forkey:"InputColor1") at //enlarge picture, enlarge five times times -Let transform = Cgaffinetransformmakescale (5,5) - //Zoom in -Let Transformiamge =colorFilter.outputImage.imageByApplyingTransform (Transform) - - in //take a picture with a imageview to try the effect ha (note to turn Ciimage into UIImage) -Qrcodeview.image =UIImage (CIIMAGE:TRANSFORMIAMGE) to +}
The execution of this code is the picture shown above ~
Two-dimensional code generated in "Swift" iOS