Ios 在Swift中使用splitview时,如何操作主表以便向其添加日历
所以我对swift编程还不熟悉,我被卡住了。我试图通过使用splitview在左侧添加日历,以便为每个日期保存草图。如何使用splitview函数为日历编写代码?还是我需要用另一种方式?请查看下面的图片以更好地了解它。我所需要的帮助是,是否有一种方法可以操纵splitview,使其不仅仅使用一个表,还是另一种方法来完成此项目?Ios 在Swift中使用splitview时,如何操作主表以便向其添加日历,ios,swift,xcode,mobile,applet,Ios,Swift,Xcode,Mobile,Applet,所以我对swift编程还不熟悉,我被卡住了。我试图通过使用splitview在左侧添加日历,以便为每个日期保存草图。如何使用splitview函数为日历编写代码?还是我需要用另一种方式?请查看下面的图片以更好地了解它。我所需要的帮助是,是否有一种方法可以操纵splitview,使其不仅仅使用一个表,还是另一种方法来完成此项目? 是的,所以完全有办法做到这一点。我只是假设您要显示当前月份的日历 let calendar = Calendar.current // If you wanted, yo
是的,所以完全有办法做到这一点。我只是假设您要显示当前月份的日历
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即可完成此操作