关闭 UIScrollView 背景中的 UIKeyboardTypeDecimalPad
我正在处理一个似乎有点初级的问题。我试图关闭具有 UIScrollView
背景的 UIKeyboardTypeDecimalPad
。我见过一些解决方案,如果您只有一个数字键盘,则需要在小数点处放置一个完成按钮。问题是,我真的需要一个小数。
我的下一个想法是当用户触摸背景时关闭键盘,但由于背景是滚动视图,我似乎无法连接一个动作来拾取触摸?一种解决方案可能是创建一个自定义滚动视图控制器......所有这一切似乎都有点混乱只是为了关闭键盘。我真的必须这样做吗?
I am dealing with what seems to be a somewhat rudimentary problem. I am trying to dismiss a UIKeyboardTypeDecimalPad
that has a UIScrollView
background. I have seen some solutions that involve putting a done button where the decimal is if you have just a NumberPad. The problem is, I really need a decimal.
My next thought was to dismiss the keypad when the user touches the background, but since the background is a scroll view, I couldn't seem to connect an action to pick up a touch? One solution was to perhaps created a Custom Scroll View Controller...all of this seems a bit messy just to dismiss a keypad. Do I really have to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您在导航栏中放置
UIBarButtonItem
“完成”,它对您有用吗?您是否探索过
UITextField
属性inputAccessoryView
?Would it work for you if you put a
UIBarButtonItem
"Done" in your navigation bar?Have you explored the
UITextField
propertyinputAccessoryView
?