我有一个带有部分日期的表格视图。我希望根据日期下的项目数让每个部分都有正确的行数。
为此,我创建了一个NSMutableDictionary使用日期作为键并具有对象数组作为值的对象。我已经验证了我的字典被填充了,但是在numberOfRowsInSection方法中我的字典为每个键的长度返回0。为什么会这样?numberOfRowsInSection在方法之前被调用吗viewDidLoad?
这是我的numberOfRowsInSection方法
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return [[itemsByDate objectForKey:[datesDB objectAtIndex:section]] count];
}
这是我NSMutableDictionary在我的方法中填充我的viewDidLoad方式
 [itemsByDate setValue:items forKey:[datesDB objectAtIndex:i]];