Thursday 15 March 2012

iphone - Resign keyboard of textfield present in alertview -


I have three text fields on a alert view, I set the keyboard as decimal type,

  - (IBAction) heightMethod: (id) sender {self.utextfield = [[UITextField alloc] initWithFrame: CGRectMake (12.0, 45.0, 260.0, 25.0)]; Utextfield.placeholder = @ "Centimeter"; Self.utextfield.delegate = self; Self.utextfield.tag = 3; [Self. Tutestyle setbackgram color: [UIColor whiteColor]]; [Self. Add Alert Add Add] // Adds a password field self.ptextfield = [[UITextField alloc] initWithFrame: CGRactack (40, 80.0, 80, 25.0)]; Ptextfield.placeholder = @ "Fit"; Self.ptextfield.delegate = self; Self.ptextfield.tag = 4; [Self.ptextfield setBackgroundColor: [UIColor whiteColor]]; [Self. Alert hight add sueview: self.ptextfield]; Self.ptextfieldInches = [[UITextField alloc] initWithFrame: CGRectMake (140, 80.0, 80, 25.0)]; PtextfieldInches.placeholder = @ "" inches "; self.ptextfieldInches.delegate = self; self.ptextfieldInches.tag = 5; [PtextfieldInches Setbakgram color: [UIColor whitecolor]]; [itself. Alrthait add Swuwu: ptextfieldInches]; [Self. Tutstfild Setkiboard type: UIKeyboardTypeDecimalPad]; [Self.ptextfieldInches set keyboard type: UIKeyboardTypeDecimalPad]; [Self.ptextfield setKeyboardType: UIKeyboardTypeDecimalPad]; [itself. Alrthait show];}   

as I have The text area is tapped, the keyboard can resign only twice, but did not resign in the third time Also I added resignfirst responsible method within the warning delgate method, see here

  - ButtonAtIndex the (zero) Warning Views: (UIAlertView *) alertView click: (NSInteger) button index    

UITextField and the UITextFieldDelegate method textFieldShouldBeginEditing . Hope this should work.

or down:

  - (BOOL) textFieldShouldBeginEditing: (UITextField *) textField {textField = iVar; }    

No comments:

Post a Comment