Mam UITableView i jako metodę cellForRowAtIndexPath Zmieniam niektóre atrybuty komórki (czcionka, rozmiar itp.) Teraz wszystkie zadania wymienione poniżej działają dobrze, z wyjątkiem zmiany koloru the textLabel. Nie mogę się domyślić, dlaczego tylko ten konkretny atrybut koloru nie ulegnie zmianie. Rozglądałem się wszędzie, gdzie mogę wymyślić, dlaczego to nie działa i utknąłem. Jakieś pomysły?Tekst UITableViewCell Kolor etykiety niezmieniający się
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *kLocationAttributeCellID = @"bAttributeCellID";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kLocationAttributeCellID];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:kLocationAttributeCellID] autorelease];
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
cell.detailTextLabel.font = [UIFont fontWithName:@"Helvetica" size:14.0];
cell.detailTextLabel.numberOfLines = 0;
cell.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap;
cell.userInteractionEnabled = NO;
cell.textLabel.font = [UIFont fontWithName:@"Courier" size:18.0];
cell.textLabel.textColor = [UIColor redColor]; // this never takes effect...
}
cell.textLabel.text = @"Test Label";
cell.detailTextLabel.text = @"Test Details";
return cell;
}
Oh wow ... co bzdura . Zastanawiam się, dlaczego ma to wpływ na kolor. Próbowałem rozwiązać to przez 3 dni. Dzięki!!! – gplocke
Dziękuję bardzo! Tracimy godziny, zastanawiając się nad tym ... – ewiinnnnn