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.
我知道这是个愚蠢的问题,但作为 xcode 的初学者,我无法从任何来源找到答案,我可以从我的操作按钮调用小键盘(数字键盘)吗?我只希望我的操作按钮可以像文本字段一样调用小键盘。我应该在我的操作按钮中插入什么代码?
我的代码:
- (IBAction)setLoopBtn:(id)sender { }
再次感谢您将您的知识分享给像我这样的菜鸟。
创建一个UITextField带有框架的框架,将其从可见屏幕上移开。指定要显示的键盘类型作为该字段的默认值。点击按钮后,发送becomeFirstResponder到您的屏幕外字段。
UITextField
becomeFirstResponder
-(IBAction) ButtonClick { txtField.keyboardType = UIKeyboardTypeNumberPad; [txtField becomeFirstResponder]; }