I am using below code to create a list of rules in an alert style 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
]
)
It gives me alert view as shown below:
What I want is to make the numbered list left intended so that overflow text from each line will be left aligned. How can I achieve that?
Set the headIndent
property of paragraphStyle
to an appropriate value, for example
paragraphStyle.headIndent = 13.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With