简体   繁体   English

在键盘顶部添加可点击的“完成” UIButton

[英]Add a clickable “Done” UIButton in the top of keyboard

I would like to add a UIButton in the top of keyboard in my app view. 我想在应用程序视图的键盘顶部添加一个UIButton。 Any idea on how to do this? 关于如何执行此操作的任何想法?

You need to set the inputAccessoryView property on your text field. 您需要在文本字段上设置inputAccessoryView属性。

This can be any view - so, for example, a toolbar with a done button. 这可以是任何视图-例如带有完成按钮的工具栏。 Example: 例:

   UIToolbar * myToolbar = [[[UIToolbar alloc] initWithFrame.... etc
   // Add button to toolbar here

   myTextField.inputAccessoryView = myToolbar;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM