Table of Content
Custom text alignment of UIAlertController
:
let controller = UIAlertController(title: t, message: informative, preferredStyle: type)
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.alignment = alignment
paragraphStyle.lineBreakMode = lineBreakMode
let messageText = NSMutableAttributedString(string: info, attributes: [
NSParagraphStyleAttributeName: paragraphStyle,
NSFontAttributeName: font ?? UIFont.systemFont(ofSize: 12),
NSForegroundColorAttributeName: textColor ?? UIColor.darkGray
])
controller.setValue(messageText, forKey: "attributedMessage")