-1

Using UIAppearance, I am changing the Table View Cell's label colour. This works fine but it only colours the cells currently being seen. All the cell's out of the view (not being seen) are still the default colour (black).

In a summary, the method only changes the cell's currently being seen, not the cells out of view (scrolled out of view).

Here is my UIAppearance Code:

[[UILabel appearanceWhenContainedIn:[_textLabel class], nil]
 setTextColor:[UIColor colorWithRed:(204.0f/255.0f) green:(204.0f/255.0f) blue:(204.0f/255.0f) alpha:1.0f]];
Colton Anglin
  • 431
  • 3
  • 9
  • 19

1 Answers1

0

I guess you have a typo here, _textLabel must be a UITableViewCell not a UILabel,

[[UILabel appearanceWhenContainedIn:[YourTableViewCell class], nil]
 setTextColor:[UIColor colorWithRed:(204.0f/255.0f) green:(204.0f/255.0f) blue:(204.0f/255.0f) alpha:1.0f]];

You may check reusing cell in your cellForRowAtIndexPath:

static NSString *CellIdentifier = @"SimpleTableItem";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell==nil){
   cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
Tarek Hallak
  • 18,422
  • 7
  • 59
  • 68