redribben icon

mas3

redribben | PRO | 02/03/15 03:22:08 PM UTC | 0 ⭐ | 439 👁️ | Never ⏰ | []
Objective C |

0 B

|

None

|

0 👍

/

0 👎

- (NSMutableAttributedString *)infoText:(NSIndexPath *)indexPath {
    id specificSetting = [tableCellArray objectAtIndex:indexPath.row];
    
    NSAttributedString *dblSpc = [[NSAttributedString alloc] initWithString:@"\n\n" attributes:@{ NSFontAttributeName: [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline] }];
    //    [dblSpc addAttribute:NSFontAttributeName value:[UIFont preferredFontForTextStyle:UIFontTextStyleHeadline] range:NSMakeRange(0, dblSpc.length)];
    
    
    NSMutableAttributedString *cellInfoDetail = [[NSMutableAttributedString alloc] initWithString:[specificSetting detail]];
    [cellInfoDetail addAttribute:NSFontAttributeName
                           value:[UIFont preferredFontForTextStyle:UIFontTextStyleHeadline]
                           range:NSMakeRange(0, cellInfoDetail.length)];
    [cellInfoDetail addAttribute:NSForegroundColorAttributeName
                           value:[UIColor blackColor]
                           range:NSMakeRange(0, cellInfoDetail.length)];
    
    NSMutableAttributedString *cellInfoSetOn = [[NSMutableAttributedString alloc] initWithString:[specificSetting setOn]];
    [cellInfoSetOn addAttribute:NSFontAttributeName
                          value:[UIFont preferredFontForTextStyle:UIFontTextStyleBody]
                          range:NSMakeRange(0, cellInfoSetOn.length)];
    [cellInfoSetOn addAttribute:NSForegroundColorAttributeName
                          value:[self checkOnColor:indexPath.row]
                          range:NSMakeRange(0, cellInfoSetOn.length)];
    
    NSMutableAttributedString *cellInfoSetOff = [[NSMutableAttributedString alloc] initWithString:[specificSetting setOff]];
    [cellInfoSetOff addAttribute:NSFontAttributeName
                           value:[UIFont preferredFontForTextStyle:UIFontTextStyleBody]
                           range:NSMakeRange(0, cellInfoSetOff.length)];
    [cellInfoSetOff addAttribute:NSForegroundColorAttributeName
                           value:[self checkOffColor:indexPath.row]
                           range:NSMakeRange(0, cellInfoSetOff.length)];
    
    
    NSMutableAttributedString *infoText = [[NSMutableAttributedString alloc] init];
    [infoText appendAttributedString:cellInfoDetail];
    [infoText appendAttributedString:dblSpc];
    [infoText appendAttributedString:cellInfoSetOn];
    [infoText appendAttributedString:dblSpc];
    [infoText appendAttributedString:cellInfoSetOff];
    
//    NSLog(@"infoText");
 
    return infoText;

Comments