Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 iOS 开发的新手。当我不按任何按钮进入视图时,我需要让我的键盘出现;例如,当我有一个带有 的视图时textField,当我进入视图时,我希望键盘自动出现。如何才能做到这一点?
textField
您需要使 textField 成为第一响应者。尝试在viewDidAppear包含 textField 的视图控制器的方法中调用此方法。
viewDidAppear
[textField becomeFirstResponder];
在你的类中使用[yourTextField becomeFirstResponder]方法调用viewDidAppearor viewDidLoad。
[yourTextField becomeFirstResponder]
viewDidLoad