如何修复UILabel文字的文字字符剪切在底部

时间:2016-08-04 13:14:45

标签: uilabel nsattributedstring uifont

我的以下代码是

NSMutableParagraphStyle *body1stParagraph = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];

      body1stParagraph.alignment = NSTextAlignmentCenter;
        body1stParagraph.minimumLineHeight  = _font_Size;
        attrs = @{ NSFontAttributeName : [UIFont fontWithName:font_name size:Font_size],
                   NSParagraphStyleAttributeName : body1stParagraph,
                   NSAttachmentAttributeName: textAttachment};

此字典添加归因字符串

[attributeString addAttributes:attrs range:lineRange];

但标签的文字是剪切

enter image description here

1 个答案:

答案 0 :(得分:0)

这可能会解决您的问题 -

yourLabel.sizeToFit()