I am working on the iPhone application. I have four textfields in one of the view. In these four textfield I have one textfield in which there will be use of numberpad keybo
I suppose you could keep a global variable UITextField * selectedTextField as a pointer (weak reference) to the textField the user currently has selected. Also store IBOutlets to all the UITextField object on your view (strong references). Then wrap the entire addButtonToKeyboard body in a big if clause:
if (self.selectedTextField == self.contactNumberTextField){
// ... add button
}
You'll need to set up the UITextField delegate method
- (void)textFieldDidBeginEditing:(UITextField *)textField;
to know which textField is the currently selected one.
In fact I think you could even do it without the outlets, using selectedTextField.keyboardType property, but then again, you'll probably already have the outlets anyway since you need them to read user input from them.
Hope this helps!