У меня есть следующее:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.row==0)
{
static NSString *CellID = @"FlourishCustomCell";
FlourishCustomCell *cell = (FlourishCustomCell *) [tableView dequeueReusableCellWithIdentifier:CellID];
if (cell == nil) {
cell = [[[FlourishCustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellID] autorelease];
cell.frame = CGRectMake(0, 0.0, 292.0, 30);
}
id <NSFetchedResultsSectionInfo> sectionInfo =
[[appDelegate.fetchedResultsController sections] objectAtIndex:indexPath.section];
NSLog(@"DATE:%@", [sectionInfo name]); //Output: March 25
cell.dateLabel.text=[sectionInfo name];
NSLog(@"header cell:%@", cell.dateLabel.text); //Output:header cell:(null)
return cell;
}
else {
static NSString *CellIdentifier = @"IdeaCustomCell";
IdeaCustomCell *cell = (IdeaCustomCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[IdeaCustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.frame = CGRectMake(0, 0.0, 292.0, 70);
}
[self configureCell:cell atIndexPath:[self newIndexPathForIndexPath:indexPath]];
return cell;
}
}
Ячейки отображаются и работают нормально для части else
(IdeaCustomCell
), но по какой-то крайне неприятной причине, когда я установил dateLabel
из FlourishCell
, а затем сразу же попытаться получить доступ к этому значению, я получаю значение null
, хотя я просто установил его!И ячейка не отображается на экране.
Я попытался переопределить метод установки для dateLabel в классе FlourishCustomCell
, и я поместил туда выражение NSLog, но по какой-то причине его никогда не вызывали.
Я понятия не имею, чтоможет быть причиной этого.Я имею в виду, я распределяю прямо там и тогда, но это все еще дает мне ноль.Есть идеи?