使用lizbqrencode 生成二维码

pod 'libqrencode', '~> 3.4.2'
#import "QRCodeGenerator.h"
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib. [self createQrCode:@"www.baidu.com"];
}
- (void)createQrCode:(NSString *)str
{
    UIImageView *qrImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 320)];
    [self.view addSubview:qrImage];
    qrImage.image = [QRCodeGenerator qrImageForString:str imageSize:qrImage.bounds.size.width];
}

你可能感兴趣的:(使用lizbqrencode 生成二维码)