向UIDatePicker添加按钮 [英] Adding a button to UIDatePicker

查看:104
本文介绍了向UIDatePicker添加按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在UIDatePickerView中添加完成"按钮,以便用户可以点击它以关闭视图.

Is it possible to add a 'Done' button to a UIDatePickerView,so that users can tap it to dismiss the view.

推荐答案

您应该创建一个UIView来容纳所需的选择器和按钮,然后在需要输入日期时将该视图设置为可见屏幕的动画,并对其进行动画处理点击按钮时.我使用了这样的方案,其中按钮实际上是日期标签,并被用来开始或结束日期编辑.

You should create a UIView to hold the picker and the button you need, then animate that view into the visible screen when you need a date entered, animate it away when the button is tapped. I have used a scheme like this where the button is actually the date label and is tapped to begin or end date editing.

这篇关于向UIDatePicker添加按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆