[英]How can i manipulate an master table so i can add an calender to it when using splitview in Swift
是的,所以完全有办法做到这一点。 我只是假设您想显示当月的日历。
let calendar = Calendar.current
// If you wanted, you could easily change the 0 below to any number to get months in the future.
let targetDate = calendar.date(byAdding: .month, value: 0, to: Date(), wrappingComponents: false)!
let targetMonth = calendar.component(.month, from: targetDate)
let targetYear = calendar.component(.year, from: targetDate)
var targetMonthComponents = DateComponents()
targetMonthComponents.year = targetYear
targetMonthComponents.month = targetMonth
let targetMonthDate = calendar.date(from: targetMonthComponents)!
let numberOfDays = calendar.range(of: .day, in: .month, for: targetMonthDate)!.count
只需使用 UITableViewDataSource 即可完成此操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.