枚举法的应用 如在二维码扫描中

2018-07-18  本文已影响0人  summerTa

#import

typedefenum: NSUInteger {

    ScanSuccessJumpComeFromWB,

    ScanSuccessJumpComeFromWC

} ScanSuccessJumpComeFrom;

@interfacefriendhomepageViewController :DJBaseController

/** 判断从哪个控制器 push 过来 */

@property (nonatomic, assign) ScanSuccessJumpComeFrom comeFromVC;

@end

  self.topView.lineView.hidden = NO;

    DJWeakSelf;

    self.topView.backBlock = ^{

        if (self.comeFromVC==ScanSuccessJumpComeFromWB) {

            //NSLog(@"是从A控制器过来");

             [weakSelf.navigationControllerpopViewControllerAnimated:YES];

        }

        if (self.comeFromVC==ScanSuccessJumpComeFromWC) {

           // NSLog(@"是从c控制器过来的 ");

            [weakSelf.navigationController popToRootViewControllerAnimated:YES];

        }

    };

    [self.viewaddSubview:self.topView];

  if(idstr.length>0) {

            friendhomepageViewController *friendhomepage = [[friendhomepageViewController alloc]init];

            friendhomepage.comeFromVC=ScanSuccessJumpComeFromWC;

            friendhomepage.userid= idstr;

            [self.navigationControllerpushViewController:friendhomepageanimated:YES];

        }else{

            friendhomepageViewController *friendhomepage = [[friendhomepageViewController alloc]init];

            friendhomepage.comeFromVC=ScanSuccessJumpComeFromWB;

            //默认弄个-1值

            friendhomepage.userid=@"-1";

            [self.navigationControllerpushViewController:friendhomepageanimated:YES];

        }

        //return;

    }else{

       // NSLog(@"暂未识别出二维码");

    }

上一篇下一篇

猜你喜欢

热点阅读