How can I disable the keyboard when I touch-up inside a UITextField?
What I want to do is show a custom digital keyboard instead of the default one.
How can I disable the keyboard when I touch-up inside a UITextField?
What I want to do is show a custom digital keyboard instead of the default one.
If I understand correctly that you are looking to create a custom keyboard in the app, I don't think we need to disable the default keyboard when we touch-up inside a UITextField.
We just need to create a custom view and assign it to the inputView property of the UITextField to replace the default keyboard.
For example, something like this:
yourTextField.inputView = yourCustomKeyboardView
See more here.
 
    
    Note: For Objective-C (Xcode)
In your viewDidLoad: set delegate for textfields which you want to disable.
self.textfield.delegate = self;
and insert this delegate function:
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
     if (textField == yourTextfiledOutletInstance) {
         [self showCustomkeyboard];
        return NO;
     }
   return YES;
}
//Show custom keyboard
-(void)showCustomkeyboard{
  // Handle your operation here to show custom keyboard
}
 
    
    set the UITextField delegate in the ViewController class, and then add this method in the class
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
      [textField resignFirstResponder];
      return NO;
  }
Use resignFirstResponder to dismiss your keyboard.
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
      [textField resignFirstResponder];
      return NO;
}
set inputView on the UITextView to the custom view you want to be used in place of the system keyboard.
myTextView.inputView = myCustomView;
