我在Json Object下面
holiDaysMap = {
January = ({
date = "01/01/2016";
dayOftheWeek = Friday;
holidayType = National;
monthName = January;
occation = "New Year's Day";
}, {
date = "01/18/2016";
dayOftheWeek = Monday;
holidayType = National;
monthName = January;
occation = “B Day";
});
July = ({
date = "07/04/2016";
dayOftheWeek = Monday;
holidayType = National;
monthName = July;
occation = “I Day";
});
}
你可以指导我如何使用Swift显示表,截面是根据表格视图上的单元格显示的数量
根据图片,我可以自定义表格,但如何显示带有月份的标题可以解释
答案 0 :(得分:1)
Month
,name : String
和index : Int
创建自定义结构holidays = [Holiday]()
。Holiday
,date : Date
,type : String
和两个计算属性occasion : String
和weekday : String
创建自定义结构day : String
,以便能够从日期开始获取本地化weekday
和day
。var months = [Month]()
。Date
值创建date
对象以获取月份整数(index
)。months
中是否存在词典键(月份名称)的条目。如果没有创建一个并将其附加到months
。holiday
项添加到holidays
的{{1}}数组。month
排序months
。index
中的项目是各个部分,months
部分名称和name
分别是行。