Commit d1212621b3bb57bac56b63de464ed3ef63088fde

Authored by zhangxiaowen
1 parent d5b843aa

no message

CNLiveQrCodeModule/Classes/Controller/CNLiveMyQrCodeController.m
@@ -205,7 +205,6 @@ static const CGFloat timeValue = 1.5; @@ -205,7 +205,6 @@ static const CGFloat timeValue = 1.5;
205 } 205 }
206 return _navigationBar; 206 return _navigationBar;
207 } 207 }
208 -  
209 - (void)rightButton{ 208 - (void)rightButton{
210 self.navigationBar.right.userInteractionEnabled = NO; 209 self.navigationBar.right.userInteractionEnabled = NO;
211 __weak typeof(self) weakSelf = self; 210 __weak typeof(self) weakSelf = self;
CNLiveQrCodeModule/Classes/Controller/CNLiveScanQrCodeController.m
@@ -264,39 +264,45 @@ static const CGFloat timeValue = 1.5; @@ -264,39 +264,45 @@ static const CGFloat timeValue = 1.5;
264 __weak typeof(self) weakSelf = self; 264 __weak typeof(self) weakSelf = self;
265 _navigationBar.onClickLeftButton = ^{ 265 _navigationBar.onClickLeftButton = ^{
266 __strong typeof(weakSelf) strongSelf = weakSelf; 266 __strong typeof(weakSelf) strongSelf = weakSelf;
267 - if(!strongSelf) return ; 267 + if(!strongSelf) return;
268 [strongSelf goBack]; 268 [strongSelf goBack];
269 }; 269 };
270 _navigationBar.onClickRightButton = ^{ 270 _navigationBar.onClickRightButton = ^{
271 - _navigationBar.right.userInteractionEnabled = NO;  
272 - // 从相册中读取二维码  
273 - [obtain establishAuthorizationQRCodeObtainAlbumWithController:nil];  
274 - if (obtain.isPHAuthorization == YES) {  
275 - [self.scanView removeTimer];  
276 - }  
277 -  
278 - __weak typeof(self) weakSelf = self;  
279 - [obtain setBlockWithQRCodeObtainAlbumDidCancelImagePickerController:^(SGQRCodeObtain *obtain) {  
280 - __strong typeof(weakSelf) strongSelf = weakSelf;  
281 - if(!strongSelf) return ;  
282 - strongSelf.navigationBar.right.userInteractionEnabled = YES;  
283 - }];  
284 - [obtain setBlockWithQRCodeObtainAlbumResult:^(SGQRCodeObtain *obtain, NSString *result) {  
285 - __strong typeof(weakSelf) strongSelf = weakSelf;  
286 - if(!strongSelf) return ;  
287 - strongSelf.navigationBar.right.userInteractionEnabled = YES;  
288 - if (result == nil) {  
289 - NSLog(@"暂未识别出二维码");  
290 - [QMUITips showError:@"暂未识别出二维码" inView:strongSelf.view hideAfterDelay:timeValue];  
291 -  
292 - } else {  
293 - [strongSelf handleResult:result];  
294 - }  
295 - }]; 271 + __strong typeof(weakSelf) strongSelf = weakSelf;
  272 + if(!strongSelf) return ;
  273 + [strongSelf rightButton];
296 }; 274 };
297 } 275 }
298 return _navigationBar; 276 return _navigationBar;
299 } 277 }
  278 +- (void)rightButton{
  279 + _navigationBar.right.userInteractionEnabled = NO;
  280 + // 从相册中读取二维码
  281 + [obtain establishAuthorizationQRCodeObtainAlbumWithController:nil];
  282 + if (obtain.isPHAuthorization == YES) {
  283 + [self.scanView removeTimer];
  284 + }
  285 +
  286 + __weak typeof(self) weakSelf = self;
  287 + [obtain setBlockWithQRCodeObtainAlbumDidCancelImagePickerController:^(SGQRCodeObtain *obtain) {
  288 + __strong typeof(weakSelf) strongSelf = weakSelf;
  289 + if(!strongSelf) return ;
  290 + strongSelf.navigationBar.right.userInteractionEnabled = YES;
  291 + }];
  292 + [obtain setBlockWithQRCodeObtainAlbumResult:^(SGQRCodeObtain *obtain, NSString *result) {
  293 + __strong typeof(weakSelf) strongSelf = weakSelf;
  294 + if(!strongSelf) return ;
  295 + strongSelf.navigationBar.right.userInteractionEnabled = YES;
  296 + if (result == nil) {
  297 + NSLog(@"暂未识别出二维码");
  298 + [QMUITips showError:@"暂未识别出二维码" inView:strongSelf.view hideAfterDelay:timeValue];
  299 +
  300 + } else {
  301 + [strongSelf handleResult:result];
  302 + }
  303 + }];
  304 +
  305 +}
300 - (SGQRCodeScanView *)scanView { 306 - (SGQRCodeScanView *)scanView {
301 if (!_scanView) { 307 if (!_scanView) {
302 _scanView = [[SGQRCodeScanView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; 308 _scanView = [[SGQRCodeScanView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
Example/CNLiveQrCodeModule/CNLIVEAppDelegate.m
@@ -63,7 +63,7 @@ @@ -63,7 +63,7 @@
63 }]; 63 }];
64 self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 64 self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
65 65
66 - CNLiveScanQrCodeController *vc = [[CNLiveScanQrCodeController alloc] init]; 66 + CNLiveMyQrCodeController *vc = [[CNLiveMyQrCodeController alloc] init];
67 // vc.ID = @"http://www.baidu.com"; 67 // vc.ID = @"http://www.baidu.com";
68 UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc]; 68 UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:vc];
69 69