Display keyboard without animation

后端 未结 7 1506
感情败类
感情败类 2020-11-29 03:12

Looked intoUIKeyboardAnimationDurationUserInfoKey but I just can\'t find anywhere how to set it to a custom value.

7条回答
  •  再見小時候
    2020-11-29 03:36

    iOS8-compatible:

    Add the appropriate delegate method:

    - (void)textFieldDidBeginEditing:(UITextField *)textField {
        [UIView setAnimationsEnabled:NO];
    }
    

    or

    - (void)textViewDidBeginEditing:(UITextView *)textView {
        [UIView setAnimationsEnabled:NO];
    }
    

    Add the keyboard notification:

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didShowKeyboard:) name:UIKeyboardDidShowNotification object:nil];
    

    And method:

    - (void)didShowKeyboard:(NSNotification *)notification {
        [UIView setAnimationsEnabled:YES];
    }
    

提交回复
热议问题