美文网首页
生成二维码

生成二维码

作者: 法库德 | 来源:发表于2017-10-25 15:08 被阅读0次

    导入lizbqrencode第三方文件夹

    头文件

    #import "QRCodeGenerator.h"

    {

    UIImageView *ima;

    }

    [super viewDidLoad];

    ima=[[UIImageView alloc]initWithFrame:CGRectMake(40, 50, 100, 100)];

    [self.view addSubview:ima];

    UIButton *bu=[[UIButton alloc]initWithFrame:CGRectMake(120, 240, 100, 44)];

    bu.backgroundColor=[UIColor redColor];

    [bu setTitle:@"生成" forState:UIControlStateNormal];

    [bu addTarget:self action:@selector(fan) forControlEvents:UIControlEventTouchUpInside];

    [self.view addSubview:bu];

    }

    -(void)fan

    {

    ima.image = [QRCodeGenerator qrImageForString:@"付洪恩" imageSize:ima.bounds.size.width];

    NSString * str;

    [[UIApplication sharedApplication] openURL:str];

    }

    相关文章

      网友评论

          本文标题:生成二维码

          本文链接:https://www.haomeiwen.com/subject/rwmqpxtx.html