二維碼使用之二維碼生成

在我的資源下載Libqrencode 這個庫  然後導入庫

//二維碼圖片
        if (!_qRImg) {
            _qRImg = [[DLImageView alloc] initWithFrame:CGRectMake(30, YHeight(_avatar) + 20, self.frame.size.width - 60, self.frame.size.width - 60)];
            _qRImg.userInteractionEnabled = YES;
//            _qRImg.backgroundColor = [UIColor grayColor];
  
//            self.qRImg.delegate = self;
            [self addSubview:self.qRImg];
        }
        
        UIImage *image = [QRCodeGenerator qrImageForString:[NSString stringWithFormat:@"http://www.baidu.com"] imageSize:_qRImg.frame.size.width];
        [_qRImg setImage:image];


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章