На рисунке видно, что ваша модель представляет собой набор действий, которые пользователь планирует выполнить.Я бы расставил вещи так:
1) MyAction - это объект NSO с именем и датой исполнения.MyAction реализует что-то вроде этого:
- (NSString *)timeRemainingString {
NSDate *now = [NSDate date];
NSTimeInterval secondsLeft = [self.dueDate timeIntervalSinceDate:now];
// divide by 60, 3600, etc to make a pretty string with colons
// just to get things going, for now, do something simple
NSString *answer = [NSString stringWithFormat:@"seconds left = %f", secondsLeft];
return answer;
}
2) StatusViewController хранит дескриптор модели, которая является NSArray для MyActions, он также имеет NSTimer (только один), который сообщает, что время проходит.
// schedule timer on viewDidAppear
// invalidate on viewWillDisappear
- (void)timerFired:(NSTimer *)timer {
[self.tableView reloadData];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.model.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
MyAction *myAction = [self.model objectAtIndex:indexPath.row];
// this can be a custom cell. to get it working at first,
// maybe start with the default properties of a UITableViewCell
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = [myAction timeRemainingString];
cell.detailTextLabel.text = [myAction name];
}