views:

156

answers:

1

I followed the tutorial

http://www.neoos.ch/news/46-development/54-uikeyboardtypenumberpad-and-the-missing-return-key

to dismiss the number pad, this tutorial add the button as sub view to the number pad,

my problem is, in the same view i am using the text field to enter text also,so, how to differentiate the number field, and text field. so that i can hide the button view accordingly.

thanks in advance.

A: 

Yoy can use UITextFieldDelegate Protocol instead of NSNotifications, and inside methods textFieldDidBeginEditing: and textFieldDidEndEditing: check which field is being used. Something like this:

- (void) textFieldDidBeginEditing:(UITextField *)textField { 
if (textField == self.passwordField) {
  // add subview...
}
bsboris
This method not getting called, i have used UITextFieldDelegate protocol. can u tell the reasons,
mac
It should be called. Please make sure that you've connected text field's delegate outlet to the view controller in Interface Builder.
bsboris