现在的app对二维码的使用越来越频繁了,几乎每个App都有这个功能,而在iOS8之前想要识别系统相册中的二维码,只能使用第三方,iOS8之后系统加入的原生识别二维码的方式,很简单
需要先声明代理方法
@interface ViewController ()<UINavigationControllerDelegate,UIImagePickerControllerDelegate>
UIImagePickerController *imagrPicker = [[UIImagePickerController alloc]init]; imagrPicker.delegate = self; imagrPicker.allowsEditing = YES; //将来源设置为相册 imagrPicker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum; [self presentViewController:imagrPicker animated:YES completion:nil];
代理方法
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info{ //获取选中的照片 UIImage *image = info[