如何设置第一响应器? [英] How do I set the firstresponder?

查看:140
本文介绍了如何设置第一响应器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个通过IB建立的视图,有一个文本视图和按钮。当视图显示时,我想让键盘已经显示。



我试图在didViewLoad中设置第一个响应,但没有工作。 / p>

我有一个连接到textView和相关访问器的IBOutlet。

解决方案

看起来您可能意外拼写了方法名称​​ didViewLoad ,而不是 viewDidLoad 。所有你需要的(假设你的IBOutlet在IB连接)是以下:

  [textView becomeFirstResponder]; 


I have a view built through IB, there's a text view and and button on it. When the view shows up I would like to have the keyboard to be already displayed.

I tried to set the first responder in the didViewLoad but that didn't work.

I do have an IBOutlet that is connected to the textView and related accessor.

解决方案

Looks like you may have accidentally misspelled the method name didViewLoad instead of viewDidLoad. All you should need there (assuming your IBOutlet is connected in IB) is the following:

[textView becomeFirstResponder];

这篇关于如何设置第一响应器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆