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;
iOS给UILabel设置内边距
最新推荐文章于 2024-08-01 04:37:51 发布
本文介绍如何使用Swift编程语言和NSAttributedString类来设置文本的段落样式,包括对齐方式、首行缩进等属性,实现文本的美观排版。
2122

被折叠的 条评论
为什么被折叠?



