zoukankan      html  css  js  c++  java
  • 拍照识别银行卡卡号

    #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];
    }

  • 相关阅读:
    Shell基本语法
    CURL简单使用
    <C> 字符串简单习题
    <C> 字符串相关的函数
    <C> 内存分区
    <C> 最大值以及最大值下标 二分查找(折半查找)
    <C> 函数 函数指针
    <C> 冒泡排序及其非常非常非常简单的优化
    <C> typedef 宏 const 位运算
    <C> 数组
  • 原文地址:https://www.cnblogs.com/sayimba/p/5666273.html
Copyright © 2011-2022 走看看