<转>textView return 键盘 textfield 键盘

转自 http://blog.sina.com.cn/s/blog_a568ec6b01011zbx.html

 

1 遵守uitextviewdelegate

2
-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString*)text 

    if ([text isEqualToString:@"\n"]) { 
        [textView resignFirstResponder];  
       return NO; 
   } 
   return YES; 
 
 
 
UITextFieldDelegate
- (BOOL)textFieldShouldReturn:(UITextField *)textField

{

    [textField resignFirstResponder];

   

    return YES;

    

}

你可能感兴趣的:(textfield)