Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在学习 swift,并且我有一个使用 CalendarKit 的项目。我想将日期放入导航标题中,以便在滑动时更改当前日期。但我对此没有任何想法......
它非常简单:步骤 I- 在 viewDidLoad ()函数中编写以下代码来设置navigationTitle。
self.navigationItem.title = "\(Date())"
步骤 II-您可以通过在滑动操作中使用相同的代码来更改滑动时的导航标题。
例如:
func onSwipeChangeTitle() { self.navigationItem.title = "\(Date())". }