Search This Blog

Tuesday, 30 October 2012

Hide Keyboard in xcode

hello,
       find the code for hiding keyboard on click of return.

For textField:

-(BOOL)textFieldShouldReturn:(UITextField *)textField{
 [textfield resignFirstResponder];
}

for TextView:


- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {
   
    if([text isEqualToString:@"\n"]) {
          [textView resignFirstResponder];
         }
   
    return YES;
}


Include delegate for UITextField and UITextView

No comments:

Post a Comment