Commit c421b9883be10f1c6c03fb35290ffbb31421589c

Authored by zhangxiaowen
1 parent d1212621

no message

CNLiveQrCodeModule/Classes/Controller/CNLiveGenerateQrCodeController.m
... ... @@ -197,56 +197,60 @@ static const CGFloat timeValue = 1.5;
197 197 [strongSelf goBack];
198 198 };
199 199 _navigationBar.onClickRightButton = ^{
200   - _navigationBar.right.userInteractionEnabled = NO;
201   - __weak typeof(self) weakSelf = self;
202   - QMUIAlertAction *action1 = [QMUIAlertAction actionWithTitle:@"保存图片" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
203   - __strong typeof(weakSelf) strongSelf = weakSelf;
204   - if(!strongSelf) return ;
205   - [strongSelf getPHAuthorizationStatus:^{
206   - UIImage *image = [strongSelf generateImage:strongSelf.qrCodeView];
207   - [QMUITips showLoadingInView:strongSelf.view];
208   - [strongSelf saveImage:image];
209   - [QMUITips hideAllTipsInView:strongSelf.view];
210   - }];
211   - _navigationBar.right.userInteractionEnabled = YES;
212   -
213   - }];
214   - QMUIAlertAction *action2 = [QMUIAlertAction actionWithTitle:@"扫描二维码" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
215   - __strong typeof(weakSelf) strongSelf = weakSelf;
216   - if(!strongSelf) return ;
217   - CNLiveScanQrCodeController *vc = [[CNLiveScanQrCodeController alloc]init];
218   - [strongSelf.navigationController pushViewController:vc animated:YES];
219   -
220   - _navigationBar.right.userInteractionEnabled = YES;
221   - }];
222   - QMUIAlertAction *cancel = [QMUIAlertAction actionWithTitle:@"取消" style:QMUIAlertActionStyleCancel handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
223   - __strong typeof(weakSelf) strongSelf = weakSelf;
224   - if(!strongSelf) return ;
225   - _navigationBar.right.userInteractionEnabled = YES;
226   -
227   - }];
228   -
229   - QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:@"" message:@"" preferredStyle:QMUIAlertControllerStyleActionSheet];
230   - alertController.delegate = self;
231   - [alertController addAction:action1];
232   - [alertController addAction:action2];
233   - [alertController addAction:cancel];
234   -
235   - NSMutableDictionary *titleAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
236   -
237   - titleAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
238   -
239   - NSMutableDictionary *cancelAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
240   - cancelAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
241   -
242   - action1.buttonAttributes = titleAttributs;
243   - action2.buttonAttributes = titleAttributs;
244   - cancel.buttonAttributes = cancelAttributs;
245   -
246   - [alertController showWithAnimated:YES];
  200 + __strong typeof(weakSelf) strongSelf = weakSelf;
  201 + if(!strongSelf) return ;
  202 + [strongSelf rightButtonOnClick];
247 203 };
248 204 }
249 205 return _navigationBar;
250 206 }
  207 +- (void)rightButtonOnClick{
  208 + _navigationBar.right.userInteractionEnabled = NO;
  209 + __weak typeof(self) weakSelf = self;
  210 + QMUIAlertAction *action1 = [QMUIAlertAction actionWithTitle:@"保存图片" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  211 + __strong typeof(weakSelf) strongSelf = weakSelf;
  212 + if(!strongSelf) return ;
  213 + [strongSelf getPHAuthorizationStatus:^{
  214 + UIImage *image = [strongSelf generateImage:strongSelf.qrCodeView];
  215 + [QMUITips showLoadingInView:strongSelf.view];
  216 + [strongSelf saveImage:image];
  217 + [QMUITips hideAllTipsInView:strongSelf.view];
  218 + }];
  219 + strongSelf.navigationBar.right.userInteractionEnabled = YES;
  220 +
  221 + }];
  222 + QMUIAlertAction *action2 = [QMUIAlertAction actionWithTitle:@"扫描二维码" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  223 + __strong typeof(weakSelf) strongSelf = weakSelf;
  224 + if(!strongSelf) return ;
  225 + CNLiveScanQrCodeController *vc = [[CNLiveScanQrCodeController alloc]init];
  226 + [strongSelf.navigationController pushViewController:vc animated:YES];
251 227  
  228 + strongSelf.navigationBar.right.userInteractionEnabled = YES;
  229 + }];
  230 + QMUIAlertAction *cancel = [QMUIAlertAction actionWithTitle:@"取消" style:QMUIAlertActionStyleCancel handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  231 + __strong typeof(weakSelf) strongSelf = weakSelf;
  232 + if(!strongSelf) return ;
  233 + strongSelf.navigationBar.right.userInteractionEnabled = YES;
  234 +
  235 + }];
  236 +
  237 + QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:@"" message:@"" preferredStyle:QMUIAlertControllerStyleActionSheet];
  238 + alertController.delegate = self;
  239 + [alertController addAction:action1];
  240 + [alertController addAction:action2];
  241 + [alertController addAction:cancel];
  242 +
  243 + NSMutableDictionary *titleAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  244 +
  245 + titleAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
  246 +
  247 + NSMutableDictionary *cancelAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  248 + cancelAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
  249 +
  250 + action1.buttonAttributes = titleAttributs;
  251 + action2.buttonAttributes = titleAttributs;
  252 + cancel.buttonAttributes = cancelAttributs;
  253 +
  254 + [alertController showWithAnimated:YES];
  255 +}
252 256 @end
... ...
CNLiveQrCodeModule/Classes/Controller/CNLiveMyQrCodeController.m
... ... @@ -199,13 +199,13 @@ static const CGFloat timeValue = 1.5;
199 199 _navigationBar.onClickRightButton = ^{
200 200 __strong typeof(weakSelf) strongSelf = weakSelf;
201 201 if(!strongSelf) return ;
202   - [strongSelf rightButton];
  202 + [strongSelf rightButtonOnClick];
203 203  
204 204 };
205 205 }
206 206 return _navigationBar;
207 207 }
208   -- (void)rightButton{
  208 +- (void)rightButtonOnClick{
209 209 self.navigationBar.right.userInteractionEnabled = NO;
210 210 __weak typeof(self) weakSelf = self;
211 211 QMUIAlertAction *action1 = [QMUIAlertAction actionWithTitle:@"保存图片" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
... ...
CNLiveQrCodeModule/Classes/Controller/CNLiveScanQrCodeController.m
... ... @@ -244,7 +244,6 @@ static const CGFloat timeValue = 1.5;
244 244  
245 245 }
246 246  
247   -#pragma mark - 选择图片识别二维码
248 247 #pragma mark - 懒加载
249 248 - (CNLiveNavigationBar *)navigationBar {
250 249 if (!_navigationBar) {
... ... @@ -267,15 +266,17 @@ static const CGFloat timeValue = 1.5;
267 266 if(!strongSelf) return;
268 267 [strongSelf goBack];
269 268 };
  269 +
  270 +#pragma mark - 选择图片识别二维码
270 271 _navigationBar.onClickRightButton = ^{
271 272 __strong typeof(weakSelf) strongSelf = weakSelf;
272 273 if(!strongSelf) return ;
273   - [strongSelf rightButton];
  274 + [strongSelf rightButtonOnClick];
274 275 };
275 276 }
276 277 return _navigationBar;
277 278 }
278   -- (void)rightButton{
  279 +- (void)rightButtonOnClick{
279 280 _navigationBar.right.userInteractionEnabled = NO;
280 281 // 从相册中读取二维码
281 282 [obtain establishAuthorizationQRCodeObtainAlbumWithController:nil];
... ...