Reputation: 1
Trying to change the UITableViewCell
text UIColour
(costume cell) will make the text become white and unseen, than only when touching the UITableViewCell
, I can see the text .
Why setting UIColour
to a UITableViewCell
that is not blackColor
will not work ?
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell =
[self.tableView dequeueReusableCellWithIdentifier:CellIdentifier
forIndexPath:indexPath];
if (!indexPath.row) {
NSDictionary *dic= [[GlobalData sharedGlobals].categories
objectAtIndex:indexPath.section];
cell.textLabel.text = [dic objectForKey:@"title"]; // only top row showing
cell.textLabel.font = [UIFont fontWithName:@"Arial Rounded MT Bold"
size:22];
cell.textLabel.textColor = [UIColor colorWithRed:177
green:218
blue:229
alpha:1];
//cell.textLabel.backgroundColor = [UIColor colorWithRed:218
green:241
blue:245
alpha:1];
} else {
NSMutableArray *typesOfSection =
[[GlobalData sharedGlobals].typesByCategories
objectAtIndex:indexPath.section];
NSDictionary *type = [typesOfSection objectAtIndex:indexPath.row-1];
NSString *titleOfType = [type objectForKey:@"title"];
cell.textLabel.text = titleOfType;
cell.textLabel.textColor = [UIColor colorWithRed:122
green:181
blue:196
alpha:1];
cell.textLabel.font = [UIFont fontWithName:@"Arial Rounded MT Bold"
size:22];
//cell.textLabel.text = @"check";
cell.accessoryView = nil;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
return cell;
}
And when doing this :
cell.textLabel.textColor = [UIColor redColor];
its working..
Upvotes: 0
Views: 98
Reputation: 3663
Use this You did not add .0f(float) behind each parameter by which you are not getting cell textcolor.
[UIColor colorWithRed:122.0f/255.0f green:181.0f/255.0f blue:196 .0f/255.0f alpha:1.0f];
Upvotes: 1
Reputation: 2177
You are basically setting the cell's text colour to white. The RGB values should be between 0.0 and 1.0.
Try this
[UIColor colorWithRed:122.0/255.0 green:181.0/255.0 blue:196.0/255.0 alpha:1.0];
Upvotes: 2