Swift属于左侧预期编号列表

Swift属于左侧预期编号列表,第1张

概述我使用下面的代码在警报样式UIAlertController中创建规则列表 let paragraphStyle = NSMutableParagraphStyle()paragraphStyle.alignment = NSTextAlignment.Leftlet messageText = NSMutableAttributedString( string: "1. Do not 我使用下面的代码在警报样式UIAlertController中创建规则列表

let paragraphStyle = NSMutableParagraphStyle()paragraphStyle.alignment = NSTextAlignment.leftlet messageText = NSMutableAttributedString(    string: "1. Do not bully or target other users.\n2. Do not post others' private information.\n3. Do not post useless or offensive content.\n4. Do not post others' copyrighted content.\n5. DownVote and Flag posts which violate these rules.\n6. If you violate these rules,your account may be suspended and/or your content removed.",attributes: [        NSParagraphStyleAttributename: paragraphStyle,NSFontAttributename : UIFont(name: "Lato-Regular",size: 13.0)!,NSForegroundcolorAttributename : colorAccentWords    ])

它给了我警报视图,如下所示:

我想要的是使编号列表保持预期,以便每行的溢出文本将保持对齐.我怎样才能做到这一点?

解决方法 例如,将paragraphStyle的headindent属性设置为适当的值

paragraphStyle.headindent = 13.0
总结

以上是内存溢出为你收集整理的Swift属于左侧预期编号列表全部内容,希望文章能够帮你解决Swift属于左侧预期编号列表所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1007225.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存