i found the solution in this way:
First Intitalize array of color code in the following way:
colors = [[NSArray alloc] initWithObjects: @"0x808000",@"0x008080",@"0x9999FF",@"0x008080",@"0x993366",@"0xFFFF99",@"0xFF8080",@"0x0066CC",@"0x008080",@"0xFF99CC",@"0x3366FF",@"0x99CC00",@"0x969696",@"0xFF9900",@"0x993300", nil ];
Second in the UITableView's CellForRowAtIndexPath method. write the following code:
NSString *colorCode = [colors objectAtIndex:indexPath.row]; // Convert Color to RGB NSScanner *scanner2 = [NSScanner scannerWithString:colorCode]; unsigned baseColor1; [scanner2 scanHexInt:&baseColor1]; CGFloat listviewred = ((baseColor1 & 0xFF0000) >> 16) / 255.0f; CGFloat listviewgreen = ((baseColor1 & 0x00FF00) >> 8) / 255.0f; CGFloat listviewblue = (baseColor1 & 0x0000FF) / 255.0f;
Give ColorCode to cell text color like below method:
Cell.textLable.textColor = [UIColor colorWithRed:listviewred green:listviewgreen blue:listviewblue alpha:1.0];
please check and let me know.