xcode 4 - custom keyboard

前端 未结 2 1718
半阙折子戏
半阙折子戏 2021-01-15 23:25

Is there a way to stop the default keyboard and have my custom designed keyboard when user clicks on TextField ?

I already designed my buttons to be always available

相关标签:
2条回答
  • 2021-01-15 23:53

    Starting with iOS 3.2, you can attach any UIView to your UITextField to be used as a keyboard:

    myTextField.inputView = myFakeKeyboard;
    

    You can also attach a toolbar above the keyboard (system or custom one) :

    myTextField.inputAccessoryView = myToolbar;
    

    By the way, if you need a numeric pad with 0-9, the decimal dot, and Backspace, you can use the UIKeyboardTypeDecimalPad type for your UITextField. But this one is only available starting from iOS 4.1, and you have to be aware that some locales use a comma instead of a dot as a decimal separator, and this keyboard type shows a comma or a dot regarding of the current locale of the device it's running on.

    0 讨论(0)
  • 2021-01-15 23:56

    You need to use this in your viewController and its enough :)

    - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField
    {
         return NO; //hide keyboard
    }
    
    0 讨论(0)
提交回复
热议问题