如何在Swift中向UIAlertController(UIAlertView)添加日期选择器? [英] How to add date picker to UIAlertController(UIAlertView) in Swift?

查看:303
本文介绍了如何在Swift中向UIAlertController(UIAlertView)添加日期选择器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,我需要显示一个弹出窗口来选择日期并将该日期写回视图控制器。

I have an application in which I need to display a popup to pick a date and write that date back to the view controller.

我在网上搜索了很多但是没有成功找到相关的解决方案。

I have searched online a lot but wasn't successful in finding out a relevant solution.

非常感谢任何形式的帮助。

Any kind of help is much appreciated.

推荐答案

不要使用任何类型的UIAlertView或UIAlertController。制作拥有视图并弹出它(可能使用现有的视图控制器)。视图可以很小,就像日期选择器一样,您可以在其后面放置阴影视图,就像警报一样。

Do not use any kind of UIAlertView or UIAlertController. Make your own view and pop it up (using, probably, a presented view controller). The view can be small, like an date picker, and you can put a shadow view behind it, like an alert does.

这篇关于如何在Swift中向UIAlertController(UIAlertView)添加日期选择器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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