Handling text with color headings
When using a LOT of text, is there an easier way to do this other than having lots of "\n" statements?
Thanks
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
}
NSString *label =@"Header1"@"\n";
NSString *label2 =@"\n""\n""Text1"@"\n";
NSString *label3 =@"\n""\n""\n""\n""\n""\n""\n""\n""Header2"@"\n" ;
NSString *label4 =@"\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""Text2"@ "\n";
NSString *label5 =@"\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n" "\n""\n""\n""\n""Header3"@"\n";
NSString *label6 =@"\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n""\n" "\n""\n""\n""\n""\n""\n""Text3"@"\n";
//NSString *label6 =[NSString stringWithFormat:@"%@\n%@\n%@",label1,label2,label 3];
if ([[cell.contentView subviews] count] > 0) {
id view = [[cell.contentView subviews] objectAtIndex:0];
UILabel *labelToSize = view;
[label RAD_resizeLabel:labelToSize WithSystemFontOfSize:44];
} else {
UILabel *cellLabel;
cellLabel = [label RAD_newSizedCellLabelWithSystemFontOfSize:kTextVie wFontSize];
[cell.contentView addSubview:cellLabel];
cellLabel.textColor=[[UIColor alloc] initWithRed:20.0 / 255 green:1.0 / 255 blue:1.0 / 255 alpha:1.0]; //20 59 102
[cellLabel release];
UILabel *cellLabel2;
cellLabel2 = [label2 RAD_newSizedCellLabelWithSystemFontOfSize:kTextVie wFontSize];
[cell.contentView addSubview:cellLabel2];
cellLabel2.textColor=[[UIColor alloc] initWithRed:20.0 / 255 green:89.0 / 255 blue:102.0 / 255 alpha:1.0]; //20 59 102
[cellLabel2 release];
UILabel *cellLabel3;
cellLabel3 = [label3 RAD_newSizedCellLabelWithSystemFontOfSize:kTextVie wFontSize];
[cell.contentView addSubview:cellLabel3];
cellLabel3.textColor=[[UIColor alloc] initWithRed:20.0 / 255 green:1.0 / 255 blue:1.0 / 255 alpha:1.0]; //20 59 102
[cellLabel3 release];
UILabel *cellLabel4;
cellLabel4 = [label4 RAD_newSizedCellLabelWithSystemFontOfSize:kTextVie wFontSize];
[cell.contentView addSubview:cellLabel4];
cellLabel4.textColor=[[UIColor alloc] initWithRed:20.0 / 255 green:89.0 / 255 blue:102.0 / 255 alpha:1.0]; //20 59 102
[cellLabel4 release];
|