label字体左右对齐

NSMutableAttributedString *mstr = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"%@ %@",dic[@"section"],dic[@"text"]]];

NSMutableParagraphStyle *par = [[NSMutableParagraphStyle alloc]init];

par.alignment = NSTextAlignmentJustified;

NSDictionary *dic1=@{NSParagraphStyleAttributeName : par,

NSFontAttributeName : [UIFont systemFontOfSize:15],

NSUnderlineStyleAttributeName : [NSNumber numberWithInteger:NSUnderlineStyleNone]

};

[mstr setAttributes:dic1 range:NSMakeRange(0, mstr.length)];

cell.textLabel.attributedText =mstr;

你可能感兴趣的:(label字体左右对齐)