BHQrCode
Dependency
TZImagePickerController (3.2.0)
Install
pod 'BHQrCode'
Use
// push方式會(huì)使用原有導(dǎo)航欄
BHScanController *scan = [[BHScanController alloc] initWithScanComplete:^(NSString *result, BHScanController *capture) {
NSLog(@"the result is %@", result);
}];
[self.navigationController presentViewController:scan animated:true completion:nil];
// present方式可以自定義導(dǎo)航欄
BHScanController *scan = [[BHScanController alloc] initWithScanComplete:^(NSString *result, BHScanController *capture) {
NSLog(@"the result is %@", result);
}];
[self presentViewController:scan animated:true completion:nil];
// 生成二維碼圖片
UIImage *img = [BHScanTools generate:@"http://www.bihacat.com" width:400];
UIImageView *imgV = [[UIImageView alloc] initWithImage:img];
[self.view addSubview:imgV];
// 識(shí)別指定二維碼內(nèi)容
NSString *string = [BHScanTools identify:img].firstObject;
NSLog(@"%@", string); // "http://www.bihacat.com"
Apis
屬性 | 類型 | 備注 | 默認(rèn)值 |
---|---|---|---|
scanLineImage | UIImage | 掃碼線圖片 | - |
scanImage | UIImage | 掃碼框圖片 | - |
tintColor | UIColor | 掃碼框和掃碼線顏色 | 圖片顏色 |
scanColor | UIColor | 單獨(dú)設(shè)置掃碼框顏色 | 圖片顏色 |
scanLineColor | UIColor | 單獨(dú)設(shè)置掃碼線顏色 | 圖片顏色 |
coverViewAlpha | CGFloat | 遮罩層透明度 | 0.4 |
introduceText | NSString | 提示文字內(nèi)容 | 將二維碼/條碼放入框內(nèi)膝宁,即可自動(dòng)掃描。 |
introduceFontSize | CGFloat | 提示文字字體大小 | 14 |
introduceFont | UIFont | 提示文字字體 | |
introduceTextColor | UIColor | 提示文字顏色 | UIColor.whiteColor |
introduceFrame | CGRect | 提示文字位置 | - |
appName | NSString | 無(wú)拍照權(quán)限時(shí)提示的應(yīng)用名 | 當(dāng)前應(yīng)用名 |
navigationTintColor | UIColor | 導(dǎo)航欄文字、按鈕顏色 | 白色 |
navigationBarAlpha | CGFloat | 導(dǎo)航欄透明度 | 0 白色透明 |
navigationBarTintColor | UIColor | 導(dǎo)航欄背景顏色,修改是不要忘記修改navigationBarAlpha | 白色 |
navigationTitleText | NSString | 導(dǎo)航欄標(biāo)題 | 二維碼掃描 |
showAlbum | BOOL | 是否顯示相冊(cè)按鈕 | 否 |
WechatIMG348