iOS給UILabel設置內邊距

    NSMutableParagraphStyle *style =  [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
    style.alignment = NSTextAlignmentJustified;
    style.firstLineHeadIndent = 10.0f;
    style.headIndent = 10.0f;
    style.tailIndent = -10.0f;

    NSAttributedString *attrText = [[NSAttributedString alloc] initWithString:@"" attributes:@{ NSParagraphStyleAttributeName : style}];
     
    self.contentLbl.numberOfLines = 0;
    self.contentLbl.attributedText = attrText;
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章