ios - 通过按钮用日期选择器替换 IOS 键盘
问题描述
我需要通过单击按钮用日期选择器替换已经打开的键盘!在互联网上搜索我只发现如何使用 datepicker 作为文本字段的输入。还有其他方法吗?谢谢!
解决方案
这应该用 UIDatePicker 替换键盘:
UIDatePicker *datePicker = [[UIDatePicker alloc] init];
[self.someTextField setInputView:datePicker];
确保您声明了 UIDatePicker:
class UIDatePicker : UIControl
可以在此处查看有关 UIDatePicker 的更多信息的文档。
推荐阅读
- html - 调整浏览器大小时,在左侧固定侧边栏下方移动右栏
- javascript - How to make an HTML list copyable as markdown
- html - 如何显示浏览器的屏幕宽度?
- python - 6人游戏
- android - How to prevent of loading images from previous results?
- daml - What does the 'signatory' keyword means in daml representation?
- java - 我应该如何持久化应用程序静态集合,例如登录用户的哈希图?
- python - Adding two Y Axes for a Plotly/Dash object in Flask
- logstash - 需要从日志中映射某些字段
- amazon-web-services - AWS ECS 服务内存或 CPU 要求的经验法则