Может кто-нибудь помочь мне понять это, пожалуйста?
My UITableViewCell textLabel, не обновляется до тех пор, пока я не прокрутит или не коснусь.
Загружается ViewController, он показывает правильное количество ячеек. Но контент пуст. Мне нужно прикоснуться к ней или прокрутить, чтобы появился текст textLabel.
Я делаю что-то не так здесь?
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
[[cell textLabel] setFont: [UIFont systemFontOfSize: 32.0]];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSDictionary * data = [self timeForObject: [self.months objectAtIndex:indexPath.row]];
dispatch_async(dispatch_get_main_queue(), ^{
NSString *time = [data objectForKey:@"Time"];
NSString *totalTime = [data objectForKey:@"Total Time"];
NSString * textLabel = [NSString stringWithFormat:@" %@ %@",
time, totalTime];
[[cell textLabel] setText:textLabel];
});
});
return cell;
}
Любая помощь приветствуется
Спасибо!
Нуну
EDIT:
Вызов [cell setNeedsLayout] устраняет эту проблему. Спасибо всем за вашу помощь!