UIButton return(textField textView)

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


原文地址:https://www.cnblogs.com/snake-hand/p/3143216.html