简体   繁体   English

用键盘上方的UITextField实现UIToolbar的最佳方法

[英]Best way to implement UIToolbar with UITextField above keyboard

What is the best way to have a UIToolbar with a UITextField appear above the keyboard ? 使具有UITextFieldUIToolbar出现在键盘上方的最佳方法是什么?

In particular, I'm looking for a way to implement this in iOS 6. 特别是,我正在寻找在iOS 6中实施此方法的方法。

The basic functionality I am trying to achieve is similar to iOS SMS app except the keyboard would appear by default. 我尝试实现的基本功能类似于iOS SMS应用程序,但默认情况下会出现键盘。

Thanks. 谢谢。

Either adding a toolbar to your storyboard and add an outlet to it, or add the toolbar to a xib file then use InputAccessoryView of text field you want to add the toolbar to it eg 将工具栏添加到情节提要板中并为其添加插座,或将工具栏添加至xib文件,然后使用要向其添加工具栏的文本字段的InputAccessoryView。

[[NSBundle mainBundle] loadNibNamed:@"KeyboardToolbar" owner:self options:nil];
[textField setInputAccessoryView:keyboardToolbar];

在此处输入图片说明

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

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