- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
[cell setBackgroundColor:[UIColor lightGrayColor]];
cell.textLabel.textColor = [UIColor lightTextColor];
cell.textLabel.backgroundColor = nil;
cell.detailTextLabel.textColor = [UIColor darkGrayColor];
cell.detailTextLabel.backgroundColor = nil;
// Get list of local notifications
NSArray *notificationArray = [[UIApplication sharedApplication] scheduledLocalNotifications];
UILocalNotification *notif = [notificationArray objectAtIndex:indexPath.row];
// Display notification info
[cell.textLabel setText:notif.alertBody];
NSDateFormatter *format = [[NSDateFormatter alloc] init];
[format setDateFormat:@"MMM dd 'at' HH:mm"];
NSString *dateString = [format stringFromDate:notif.fireDate];
NSString *textData = [[NSString alloc]initWithFormat:@"%@",dateString];
[cell.detailTextLabel setText:textData];
//[notif.fireDate description]
[self.tableView reloadData];
return cell;
}
Everything goes absoloutely normal if i DONT write "[self.tableView reloadData];", but if I do, seems like the cell is there but its not being displayed (the cell separator disappear according to the number of cells the tableview has)
I need to reloadData so the user won't need to get out of the view and load the view again to display updated information.
Any suggestion?