Add those methods in your ViewController.m class and then in your viewDidLoad method of ViewController.m Class
[yourTextField addTarget:yourTextFieldDelegate
action:@selector(reformatAsCardNumber:)
forControlEvents:UIControlEventEditingChanged];
set reformatCardNumber
: to be called whenever the text field fires a UIControlEventEditingChanged
event
also add delegete in Viewcontroller.h file and Thats Done.