【发布时间】:2015-02-15 07:41:39
【问题描述】:
我正在尝试为我的应用创建一个文本输入小部件。我找到了XCDFormInputAccessoryView example on Github 并对其进行了修改,使文本字段位于附件视图上。理论上,这允许我从应用程序的任何部分调用文本输入小部件。
澄清一下:在我想要展示这个小部件的任何视图控制器中都没有 textField。
但是,我似乎无法弄清楚如何呈现文本输入小部件。我试过了:
[self.inputAccessoryView becomeFirstResponder];
[self.inputAccessoryView.textField becomeFirstResponder];
[[UIApplication sharedApplication] sendAction:@selector(becomeFirstResponder) to:nil from:nil forEvent:nil];
[[UIApplication sharedApplication] sendAction:@selector(becomeFirstResponder) to:self.inputAccessoryView.textField from:nil forEvent:nil];
如果显示的文本字段是键盘本身的附件,我如何使键盘显示?
【问题讨论】:
标签: ios objective-c keyboard uitextfield uitextinput