一个简单的 iOS 控制器,用于带有日期单元格的 UITableView
(查看视频: http://screencast.com/t/Vp94gyhpjUwr)
导入所需的头文件
#import "DateCellsController.h"
创建 NSIndexPath 到 NSDate 的映射
NSIndexPath *path = [NSIndexPath indexPathForRow:2 inSection:0];
NSIndexPath *path2 = [NSIndexPath indexPathForRow:0 inSection:0];
NSIndexPath *path3 = [NSIndexPath indexPathForRow:0 inSection:1];
NSDate *date = [NSDate date];
NSDate *date2 = [NSDate dateWithTimeIntervalSinceNow:5000];
NSDate *date3 = [NSDate dateWithTimeIntervalSinceNow:10000];
NSMutableDictionary *indexPathToDateMapping = [[@{path : date,
path2 : date2,
path3 : date3}
mutableCopy] autorelease];
将控制器附加到现有具有正确映射的 UITableView 上
DateCellsController *dateCellsController = attachToTableView:self.tableView
withDelegate:self
withMapping:indexPathToDateMapping];