UILabel

    
    NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
    [paragraphStyle setLineSpacing:8];//調整行間距
    self.label.attributedText =[[NSAttributedString alloc] initWithString: self.content
                                                               attributes:@{NSFontAttributeName:
                                                                                [UIFont systemFontOfSize:ZHB14SecondFontSize],
//                                                                            NSKernAttributeName:@3.0f,//調整字與字間距
                                                                            NSParagraphStyleAttributeName:paragraphStyle}];
    
    






    NSRange smallRange = [label.text rangeOfString:@"萬" options:NSLiteralSearch];
    if (smallRange.location != NSNotFound) {
        NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithString:label.text];
        NSRange bigRange = NSMakeRange(0, label.text.length-1);
        [attributedText setAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:ZHB16FontSize]}
                                range:bigRange];
        
        label.attributedText = attributedText;
    }
相關文章
相關標籤/搜索