I have a modal view that with a UITextView, and the user can enter some text (or not) and close the modal view. There is no point of d开发者_运维技巧ismissing the keyboard as it does not dismiss the modal view (this is on purpose), and the UITextView without the keyboard just looks silly.
Is there a way to hide or remove the "Dismiss keyboard" key from the keyboard?
You can't hide or remove the key, but you can disable it using the UITextViewDelegate protocol:
- (BOOL)textViewShouldEndEditing:(UITextView *)textView {
    return NO;
}
If UIKit forces the responder to resign despite the delegate (doubtful, but I haven't looked closely at the call stack), you can force the keyboard to stay up by observing the UIKeyboardDidHideNotification and setting the  first responder back to the UITextView: [myUITextView becomeFirstResponder]
Protocol method doesn't help. As Answerbot suggested one should listen to keyboard notification.
   - (void)onIpadViewWillAppear
{
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showIpadKeyboard) name:UIKeyboardDidHideNotification object:nil];
}
- (void)onIpadViewWillDisappear
{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}
- (void)showIpadKeyboard
{
    [myTextField becomeFirstResponder];
}
This works and looks beautifully.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论