开发者

inputAccessoryView not hide the view when -resignFirstResponder?

I have attached a toolbar with a UITextField and UIButton to the keyboard when it becomes the first responder via the user taping inside the textfield

 textField.inputAccessoryView = theToolbar;

Problem is, the toolbar disappears when the keyboard is dismissed, thus preventing any further input.

Any ideas on how to make the toolbar go back to the bottom of the screen rather than off it completely?

I'm thinking a delegate method might help but Im really not too sure. It seems once the开发者_运维技巧 inputAccessoryView always the inputAccessoryView :(

Cheers


The input accessory view is automatically dismissed with the input view (the keyboard, in this case). Generally you do not want to have an input accessory view in your view hierarchy. Instead, if you want your toolbar to scroll up when the keyboard is shown, you should follow the guidelines for Managing the Keyboard.


You could try using an additional toolbar that is offscreen as the inputAccessoryView, which could "fake" the appearance of what you are trying to do. Alternatively, have you tried adding the toolbar back to the bottom of the screen using

[self.view addSubview:theToolbar];

when the keyboard reaches the bottom of the screen? You can use keyboard notifications for this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜