UIButton return(textField textView)

首先设置TextField 或 TextView的 delegate
/////UITextView
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
{
    if ([text isEqualToString:@"\n"]) {
        
        NSLog("点击return");
        return NO;
    }
    return YES;
}
/////UITextField
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    NSLog("点击return");
    return YES;
}

你可能感兴趣的:(UIButton return(textField textView))