how to make a keyboard in other language in iOS

后端 未结 4 2013
忘掉有多难
忘掉有多难 2021-01-22 14:13

I want to create a khmer keyboard which is different from iPhone keyboard. How can I do that ?

4条回答
  •  面向向阳花
    2021-01-22 14:37

    Starting from iOS 4, UITextField and UITextView have a property called inputView. It should be a view able to receive the taps and send to the UIViewController that holds your text field. So, can create a UIViewController with delegate methods, and set it's view as the inputView of your UITextField or UITextView. So, assuming that MyCustomKeyboard is the UIViewController that is your keyboard, including the view and the delegate methods, in your viewDidLoad of your view controller, you should put:

    MyCustomKeyboard *customKeyboard = [[MyCustomKeyboard alloc] init];
    customKeyboard.delegate = self;
    myTextField.inputView = customKeyboard.view;
    

    And in your view controller you handle the delegate methods of your MyCustomKeyboard class.

    If you want a tutorial, there is a good one in Ray Wenderlich website, you should do something similar to the iPhone.

提交回复
热议问题