EKEventEditViewController 添加和取消按钮丢失但可单击

问题描述 投票:0回答:1

我弹出 EKEventEditViewController,“添加”和“取消”按钮似乎就在那里 - 只是可能不可见或白色字体或其他东西。

应用程序其余部分的栏按钮项文本为白色,这与我为导航栏设置的深蓝色背景相得益彰。

这个问题有什么解决办法吗?

这是代码。非常简单。

let event = EKEvent(eventStore: eventStore)
event.title = myEvent.title
event.startDate = myEvent.dateTimeFrom

event.location = myEvent.addressFormatted()

// All day or not
if( myEvent.isAllDay() ) {
    event.isAllDay = true
}
else {
    event.endDate = myEvent.dateTimeTo
}

let eventController = EKEventEditViewController()
eventController.event = event
eventController.eventStore = eventStore
eventController.editViewDelegate = self
self.present(eventController, animated: true, completion: nil)

它的外观如下:

ios swift uinavigationbar eventkit ekevent
1个回答
0
投票

以防万一有人需要这个,无论出于何种原因,添加/取消按钮都是白色的(切换到深色模式,你就会看到它们)。

要解决此问题,在设置 EKEventViewController 之后,您可能会弄乱 UINavigationBar.appearance() 属性,这些属性将在您展示日历时应用。

//Nav bar background
UINavigationBar.appearance().backgroundColor = .red
// add + cancel text color
UINavigationBar.appearance().tintColor = .white
// title text color
UINavigationBar.appearance().titleTextAttributes = [.foregroundColor : UIColor.blue]
© www.soinside.com 2019 - 2024. All rights reserved.