//
//  AddBankCardIDViewController.m
//  ALand
//
//  Created by Z on 16/5/5.
//  Copyright © 2016年 Z. All rights reserved.
//

#import "AddBankCardIDViewController.h"
#import "NSString+Category.h"
#import "AddDetailInfoViewController.h"

@interface AddBankCardIDViewController ()<UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UIButton *btnNext;
@property (weak, nonatomic) IBOutlet UITextField *textFieldBankCardID;

@end

@implementation AddBankCardIDViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"添加银行卡";
    self.textFieldBankCardID.delegate = self;
    self.btnNext.enabled = NO;
    // Do any additional setup after loading the view from its nib.
}


- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
    NSString *strBankCardID = [textField.text stringByReplacingCharactersInRange:range withString:string];//变化后的字符串
    if ([strBankCardID isBankCard]) {
        self.btnNext.enabled = YES;
    }else{
        self.btnNext.enabled = NO;
    }
    return YES;
}
- (IBAction)actionNext:(id)sender {
    AddDetailInfoViewController *addDetailVC = [[AddDetailInfoViewController alloc] init];
    addDetailVC.isShowNavigationBar = YES;
    addDetailVC.bankCardID = self.textFieldBankCardID.text;
    addDetailVC.reseller = self.reseller;
    [self.navigationController pushViewController:addDetailVC animated:YES];
}

- (BOOL)textFieldShouldClear:(UITextField *)textField {
    self.btnNext.enabled = NO;
    
    return YES;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
