redribben

playing with attributed string

Feb 2nd, 2015
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     // Setting the ON/OFF info of the cell
  2.    
  3.     NSString *settingDetails = @"My Details I want to display";
  4.     NSString *settingON = @"This is the setting that is supposed to be on";
  5.     NSString *settingOFF = @"This is the setting that is supposed to be off";
  6.    
  7.     NSMutableAttributedString *infoText = [[NSMutableAttributedString alloc]
  8.                                            initWithString:[NSString stringWithFormat:@"%@ \n\n%@ \n\n%@", settingDetails, settingON, settingOFF]];
  9.    
  10. //    NSMutableAttributedString *infoText = [[NSMutableAttributedString alloc]
  11. //                                           initWithString:[NSString stringWithFormat:@"Hello, how\n\n you doing?"]];
  12.    
  13.     [infoText addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0,4)];
  14.    
  15.    
  16. //    cell.infoLabel.text = [[tableCellArray objectAtIndex:indexPath.row] detail];
  17.    
  18.    
  19.     cell.infoLabel.attributedText = infoText;
Advertisement
Add Comment
Please, Sign In to add comment