Reputation: 143
I want define a custom keyboard in my App,When I press one TabBar Item in my UITabBarController, then custom keyboard slide up, when I touch the the tabview, I hope the custom keyboard can slide down, But, Because the custom keyboard add in UITabBarController's view, and tableView add in UIViewController one of UITabBarController's ViewController, they are not in the same Class, How can I define the Keyboard, and add to which view?
I want to do like this: When Press tab bar Item keyboard slide up, https://i.sstatic.net/66NDu.png
When touch tableview, keyboard slide down.
https://i.sstatic.net/ZiHaR.png
Upvotes: 1
Views: 186
Reputation: 14499
Make a custom UIView with your custom keyboard buttons. UITextField and UITextView have a property called inputView. If you set your custom view to this, iOS automatically takes care of resignFirstResponder and becomesFirstResponder messages on the text field.
This is the easiest way to use a custom keyboard.
Upvotes: 1
Reputation: 12335
Why are you declaring the custom keyboard in the UITabBarController
class ? You can declare it in the view controller that is attached to that particular tabBarItem
. If you add it to the that view controller, I am sure you can just make it resignFirstResponder
or removeFromSuperView
and manipulate it as you want.
Or you can just create a separate class for your customKeyboard
, and add it along with your other classes. Simply include that class and create objects in other view controllers to manipulate them, and then release
them. This is very easy and it is better programming compared to your approach, as at a later point of time, if you need to make changes or release 2.0 version of your app, it will come in handy and save some development time !
Upvotes: 0