ios中怎么手动调label的行距

//手动调行距
+(NSAttributedString *) customSpacing:(CGFloat)space andStr:(NSString *)text{

    
    NSMutableParagraphStyle * paragraphStyle = [[NSMutableParagraphStyle alloc] init];
   
    [paragraphStyle setLineSpacing:space];
    UIColor *color = RGB(51, 51, 51);
    
    UIFont *font = [UIFont fontWithName:@"PingFangSC-Regular" size:14];
    
    NSAttributedString *string = [[NSAttributedString alloc] initWithString:text attributes:@{NSForegroundColorAttributeName : color, NSParagraphStyleAttributeName: paragraphStyle,NSFontAttributeName: font}];

    return string;
}

你可能感兴趣的:(标签,行距,oc)