iOS-UITextField和UITextView隐藏键盘

self._textField.returnKeyType=UIReturnKeyDone;

self._textField.delegate=self;

- (BOOL)textFieldShouldReturn:(UITextField *)textField{

    [textField resignFirstResponder];

    return YES;

}



self._textView.delegate=self;

self._textView.returnKeyType=UIReturnKeyDone;

- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range

 replacementText:(NSString *)text {

    if ([text isEqualToString:@"\n"]) {

        [textView resignFirstResponder];

        return NO;

    }

    return YES;

}

你可能感兴趣的:(iOS-UITextField和UITextView隐藏键盘)