I am putting dates of the year in to a uitableview (grouped style ) with each section being one week. Having 7 cells, 1 for each corresponding day of the week. I am adding 2 to indexpath.row because I want the week to start on Monday. And cells are 0 based. The issue I am having is that it works all except for the last cell on 开发者_StackOverfloweach section is being treated as indexPath.row 0. Is there anyway to fix this issue?
I think it's because the last weekday value is set to 8 (row 6 + 2 = 8), whereas the Gregorian Calendar only allows values up until 7.
From the Apple docs:
Weekday units are the numbers 1 through n, where n is the number of days in the week. For example, in the Gregorian calendar, n is 7 and Sunday is represented by 1.
精彩评论