Tableview section By Date
How to group da开发者_JAVA百科ta in the tableview by date in Xcode?
Have a look at the DateSectionTitles sample app. It demonstrates a tableview with date cells grouped by the month. It is based on CoreData.
First of all you need to find reasonable date groups: month, week, year-month combination etc. After that you'll have to find a method which can determine which of your cell has to go to which group/section, described as an NSIndexPath. numberOfSections as well as numberOfRowsInSection has to reflect your grouping idea. With the UITableViewDataSource protocol you can provide the names for your sections with titleForHeaderInSection:.
精彩评论