在我的资源下载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];