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.
我正在制作一个应用程序,我希望用户能够输入文本而无需他们实际点击 UITextField(在游戏结束后打开它以获得记分牌),有什么办法吗?
是的,只是:
<#your_text_field#>.becomeFirstResponder()
比赛结束后。
这将产生与点击UITextField. 如果这是一个新的UIViewController,你可以把它放在viewDidAppear,否则你可以假设一切都已经加载并简单地在任何地方调用它。
UITextField
UIViewController
viewDidAppear
在记分板中调用以下内容viewDidLoad,或者该视图的入口点是什么。
viewDidLoad
yourTextField.becomeFirstResponder()