键盘的inputAccessoryView属性

来源:互联网 发布:罗马军团到中国 知乎 编辑:程序博客网 时间:2024/04/29 06:30

inputAccessoryView:

UITextFields and UITextViews have an inputAccessoryView property, which you can set to any view, that is automatically displayed above and animated with the keyboard.

Note that the view you use should neither be in the view hierarchy elsewhere, nor should you add it to some superview, this is done for you.

翻译:
UITextFields和UITextView有一个inputAccessoryView的属性,当你想在键盘上展示一个自定义的view时,你就可以设置该属性。你设置的view就会自动和键盘keyboard一起显示了。

需要注意的是,你所自定义的view既不应该处在其他的视图层里,也不应该成为其他视图的子视图。其实也就是说,你所自定义的view只需要赋给属性inputAccessoryView就可以了,不要再做其他多余的操作。


例子:

其中短信发送页的键盘上的那个输入的框就是利用这个属性做的,你可以尝试一下,很简单的哦。


转载:http://blog.csdn.net/likendsl/article/details/7802025

原创粉丝点击