[关闭]
@HelloJansen 2016-07-07T07:11:57.000000Z 字数 478 阅读 230

iOS 生成二维码

iOS 二维码



  1. 首先先下载生成二维码的支持文件 libqrencode
  2. 添加依赖库 CoreGraphics.frameworkQuartzCore.frameworkAVFoundation.frameworklibiconv.dylibCoreMedia.frameworkCoreVideo.framework
  3. 在你要生成二维码的界面添加#import "QRCodeGenerator.h" 在你的要生成二维码的ImageView中一句代码搞定:imageV.image = [QRCodeGenerator qrImageForString:@"这是生成的二维码哦" imageSize:imageV.bounds.size.width]

    注意事项:如果你工程里要是写有.pch 文件,请把你支持的头文件写在只让OC类引用的格式里
    例如下面这样:
  1. #ifndef PrefixHeader_pch
  2. #define PrefixHeader_pch
  3. #ifdef __OBJC__
  4. #import "xxxxx.h"
  5. #import "xxxxx.h"
  6. #endif

就OK了

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注