Skip to content

SYZBarDemo(IOS6及以上): 支持arm64,armv7,armv7s。可摄像头扫描,生成,从系统相册读取二维码。

Notifications You must be signed in to change notification settings

maskcoder/SYZBarDemo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SYZBarDemo

SYZBarDemo(IOS6及以上): 支持arm64,armv7,armv7s。可摄像头扫描,生成,从系统相册读取二维码。

用法:

###//打开摄像头并扫描

- (IBAction)saomiaoAction:(id)sender

###{ //扫描二维码 SYQRCodeReaderController *qrcodevc = [[SYQRCodeReaderController alloc] init]; qrcodevc.SYQRCodeSuncessBlock = ^(SYQRCodeReaderController *aqrvc,NSString *qrString){ [aqrvc dismissViewControllerAnimated:NO completion:nil]; [self showAlertWithMsg:qrString]; }; qrcodevc.SYQRCodeCancleBlock = ^(SYQRCodeReaderController *aqrvc){ [aqrvc dismissViewControllerAnimated:NO completion:nil]; [self showAlertWithMsg:@"cancle~"]; }; qrcodevc.SYQRCodeFailBlock = ^(SYQRCodeReaderController *aqrvc){ [aqrvc dismissViewControllerAnimated:NO completion:nil]; [self showAlertWithMsg:@"fail~"]; }; [self presentViewController:qrcodevc animated:YES completion:nil]; ###}

###//生成二维码 ###- (IBAction)shengchengAction:(id)sender ###{ [self.xianBtn setImage:[QRCodeGenerator qrImageForString:@"https://github.com/reesun1130" imageSize:150] forState:UIControlStateNormal]; ###}

###//从相册读取二维码 ###- (IBAction)readAction:(id)sender ###{ if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypePhotoLibrary]) { //[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:NO];

    UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
    //imagePickerController.navigationBar.tintColor = kNavBgColor;
    //imagePickerController.navigationBar.backgroundColor = kNavBgColor;
    
    imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    imagePickerController.delegate = self;
    //imagePickerController.allowsEditing = YES;
    
    [self presentViewController:imagePickerController animated:NO completion:nil];
}
else
{
    [self showAlertWithMsg:@"fail~"];
}

###}

效果如下:

image

About

SYZBarDemo(IOS6及以上): 支持arm64,armv7,armv7s。可摄像头扫描,生成,从系统相册读取二维码。

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 46.9%
  • C 34.2%
  • Objective-C 18.9%