在iOS 14中以编程方式打开UIDatePicker
问题描述:
我有这个普通的UIDatePicker
(很抱歉,它不是英语的,请忽略它):
I have this normal UIDatePicker
(sorry that it's not in English, please ignore that):
但是问题在于它仅在我按下日期选择器时出现:
But the problem is that it only appears when I'm pressing the Date Picker:
我想知道如何在第一张图像中显示日期选择器(它具有模糊效果覆盖了整个屏幕)仅使用代码,因此用户不需要按日期选择器以显示日期选择器.谢谢.
And I wanted to know how to show the Date Picker like in the first image (that it's covering all the screen with the blur effect) only with code, so the user won't need to press the Date Picker to show the date selector. Thanks.
答
不可能在代码中用UIKit14
打开UIDatePicker
It's impossible to open a UIDatePicker
with UIKit14
from within the code
-
UIDatePicker
没有用于执行此操作的API -
UIKit
不允许我们创建对UIKit
有任何影响的UIEvents
或UITouch
对象.
-
UIDatePicker
has no API for doing this -
UIKit
doesn't allow us to create aUIEvents
orUITouch
object which has any impact onUIKit
.