【发布时间】:2021-10-16 11:15:06
【问题描述】:
我如下所示展示我的日历选择器:
let calendarChooser = EKCalendarChooser(selectionStyle: .single,
displayStyle: .writableCalendarsOnly,
entityType: .event,
eventStore: eventStore)
calendarChooser.showsDoneButton = true
calendarChooser.showsCancelButton = true
let navigationController = UINavigationController(rootViewController: calendarChooser)
navigationController.view.tintColor = .orange // change color of navigation controller buttons
self.present(navigationController, animated: true, completion: nil)
我更改了导航控制器按钮Cancel(左上)、Done(右上)和Add Calendar(左下)的颜色。事实上,我不需要Add calendar 功能。我在导航控制器和日历选择器上尝试了hidesBottomBarWhenPushed = false 和tabBarItem = nil。不开心。
问题一:Add calendar按钮可以去掉吗?
如果我无法删除Add Calendar 按钮,我至少希望将其Cancel 按钮(左上角)的颜色也更改为橙色(它显示默认蓝色)。
问题 2:如何更改 Add calendar 控制器上显示的 Cancel 按钮的颜色?
【问题讨论】:
-
我认为没有任何公共 API 可以删除“添加日历”。取消按钮的颜色设置为您应用的全局色调。您似乎还没有真正设置应用程序的全局色调,这就是为什么它是蓝色的。您的应用程序的全局色调也是橙色吗?如果是这样,我可以告诉你如何设置全局色调。
-
此外,删除“添加日历”有什么意义?用户总是可以在日历应用程序中添加另一个日历,因此删除它实际上不会阻止任何事情,只会给用户带来不便。对吗?
-
删除
Add calendar更像是一个装饰性的愿望。我知道它总是可以添加到其他地方,但由于我没有设法改变其中Cancel按钮的颜色,我试图将它完全删除。 - 我确实在情节提要中将全局色调颜色设置为橙色。不过Add Calendar控制器显示默认蓝色。
标签: swift eventkit ekcalendar