• 拍照识别银行卡卡号


    #import "ViewController.h"
    #import "CardIO.h"
    
    @interface ViewController ()<CardIOPaymentViewControllerDelegate>
    
    @end
    
    @implementation ViewController
    
    - (void)viewDidLoad {
        [super viewDidLoad];
    
        UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
        btn.frame = CGRectMake(100, 100, 100, 100);
        btn.backgroundColor  =[UIColor cyanColor];
        [btn  addTarget:self action:@selector(pressBtn) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:btn];
    }
    
    -(void)pressBtn{
        
        
        CardIOPaymentViewController *scanViewController = [[CardIOPaymentViewController alloc] initWithPaymentDelegate:self];
        scanViewController.modalPresentationStyle = UIModalPresentationFormSheet;
        [self presentViewController:scanViewController animated:YES completion:nil];
    
        
        
    }
    #pragma mark - CardIOPaymentViewControllerDelegate
    
    - (void)userDidProvideCreditCardInfo:(CardIOCreditCardInfo *)info inPaymentViewController:(CardIOPaymentViewController *)paymentViewController {
        NSLog(@"Scan succeeded with info: %@", info);
        // Do whatever needs to be done to deliver the purchased items.
        [self dismissViewControllerAnimated:YES completion:nil];
    
        UILabel * label = [[UILabel alloc]init];
        label.frame = CGRectMake(100, 250, 100, 100);
        label.text = [NSString stringWithFormat:@"Received card info. Number: %@, expiry: %02lu/%lu, cvv: %@.", info.redactedCardNumber, (unsigned long)info.expiryMonth, (unsigned long)info.expiryYear, info.cvv];
    }
    
    - (void)userDidCancelPaymentViewController:(CardIOPaymentViewController *)paymentViewController {
        NSLog(@"User cancelled scan");
        [self dismissViewControllerAnimated:YES completion:nil];
    }
    
    -(void)viewWillAppear:(BOOL)animated{
        [CardIOUtilities preload];
    }

  • 相关阅读:
    蚂蚁金服SOFAMesh在多语言上的实践
    2018第48周日
    git只拉取github部分代码的方法
    深入理解brew link命令
    openssl/ssl.h file not found
    react热加载失败
    pycharm批量清楚pyc、$py.class文件
    Hash history cannot PUSH the same path; a new entry will not be added to the history stack
    JavaScript indexOf() 方法,获取元素的位置;Object.keys()获取对象的所有key的数组
    JavaScript删除数组里的某个元素
  • 原文地址:https://www.cnblogs.com/sayimba/p/5666273.html
Copyright © 2020-2023  润新知