iOS給UILabel設定內邊距
阿新 • • 發佈:2021-01-17
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;