Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/114.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在Swift中使用splitview时,如何操作主表以便向其添加日历_Ios_Swift_Xcode_Mobile_Applet - Fatal编程技术网

Ios 在Swift中使用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

所以我对swift编程还不熟悉,我被卡住了。我试图通过使用splitview在左侧添加日历,以便为每个日期保存草图。如何使用splitview函数为日历编写代码?还是我需要用另一种方式?请查看下面的图片以更好地了解它。我所需要的帮助是,是否有一种方法可以操纵splitview,使其不仅仅使用一个表,还是另一种方法来完成此项目?

是的,所以完全有办法做到这一点。我只是假设您要显示当前月份的日历

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即可完成此操作