gpt4 book ai didi

Swift 属性左预期编号列表

转载 作者:搜寻专家 更新时间:2023-10-30 23:02:13 24 4
gpt4 key购买 nike

我正在使用下面的代码创建一个警报样式的规则列表 UIAlertController

let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.alignment = NSTextAlignment.Left
let 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
]
)

它给我如下所示的警报 View : enter image description here

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

最佳答案

paragraphStyleheadIndent属性设置为合适的值,例如

paragraphStyle.headIndent = 13.0

关于Swift 属性左预期编号列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31090587/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com