计算未完成提醒的更好方法&更新表格视图单元格?

时间:2013-08-12 14:09:36

标签: ios uitableview eventkit

我正在使用它计算defult列表中所有未完成的提醒,并将其放在表格视图单元格的详细信息中:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{    
...
    NSPredicate *predicate2 = [self.reminderStore predicateForIncompleteRemindersWithDueDateStarting:nil ending:nil calendars:@[[self.reminderStore defaultCalendarForNewReminders]]];
    [self.reminderStore fetchRemindersMatchingPredicate:predicate2 completion:^(NSArray *reminders)
    {
         cell.detailTextLabel.text = [NSString stringWithFormat:@"%d", [reminders count]];
         NSLog(@"count: %d", [reminders count]);
     }];
...
return cell;
}

问题在于,因为它在另一个线程上,所以它不会更新表格单元格,直到它需要重新加载它。 (它会打印在日志中)。修复它的最佳方法是什么,所以它会自动加载而不需要每次都加载?此外,还有另一种方法可以更快地计算提醒吗?

0 个答案:

没有答案