redribben icon

playing with attributed string

redribben | PRO | 02/02/15 08:10:34 AM UTC | 0 ⭐ | 443 👁️ | Never ⏰ | []
Objective C |

0 B

|

None

|

0 👍

/

0 👎

    // Setting the ON/OFF info of the cell
    
    NSString *settingDetails = @"My Details I want to display";
    NSString *settingON = @"This is the setting that is supposed to be on";
    NSString *settingOFF = @"This is the setting that is supposed to be off";
    
    NSMutableAttributedString *infoText = [[NSMutableAttributedString alloc]
                                           initWithString:[NSString stringWithFormat:@"%@ \n\n%@ \n\n%@", settingDetails, settingON, settingOFF]];
    
//    NSMutableAttributedString *infoText = [[NSMutableAttributedString alloc]
//                                           initWithString:[NSString stringWithFormat:@"Hello, how\n\n you doing?"]];
    
    [infoText addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0,4)];
    
    
//    cell.infoLabel.text = [[tableCellArray objectAtIndex:indexPath.row] detail];
    
    
    cell.infoLabel.attributedText = infoText;

Comments