Alert controller description message are not multiline , it get truncated tail.?

I'm using the alert controller (NSMutableAttributedString for title and message) to display an alert, but my message gets truncated at it's not multiline. So anyway to multiline the message or I may need to changes any property for that please suggest. The message comes from a server that's why it isn't possible to add the \n.

Please post any solution. Thanks in advance!

I just make normal demo it works perfectly, but I don't know why it will be not working in my project code?

Here is my code:

    self.navigationController?.navigationBar.isHidden = true
    let alrtTitleStr = NSMutableAttributedString(string:"Title message which will from server")
    alrtTitleStr.addAttribute(NSAttributedStringKey.font, value: UIFont.boldSystemFont(ofSize: 18.0) , range: NSRange(location: 0, length: alrtTitleStr.length))

    let alrtMessage = NSMutableAttributedString(string:"Here is the message which comes from server and it should be display in muultiline.")
    alrtMessage.addAttribute(NSAttributedStringKey.font, value:  UIFont.systemFont(ofSize:16.0) , range: NSRange(location: 0, length: alrtMessage.length))

    let alertController = UIAlertController(title: "", message: "", preferredStyle: .alert)
    alertController.setValue(alrtTitleStr, forKey: "attributedTitle")
    alertController.setValue(alrtMessage, forKey: "attributedMessage")

    let btnYes = UIAlertAction(title: "Yes", style: .default, handler: { action in
       //next process
    })
    let btnNo = UIAlertAction(title: "No", style: .default, handler: { action in
        //next process
    })

    alertController.addAction(btnYes)
    alertController.addAction(btnNo)
    self.present(alertController, animated: true, completion: nil)

UIAlertController, Use this class to configure alerts and action sheets with the message that you The UIAlertController class is intended to be used as-is and does not support  2 Alert controller description message are not multiline , it get truncated tail.? Jul 12 '18. 1 git show writing 100% but still show fatal: The remote end hung up

let strAttributes = [NSFontAttributeName: UIFont.boldSystemFont(ofSize: 18.0)] let alrtTitleStr = NSMutableAttributedString(string: "Title message which will from server", attributes: strAttributes)

    let strAttributesMs = [NSFontAttributeName:UIFont.systemFont(ofSize:16.0)]
    let alrtMessage = NSMutableAttributedString(string: "Here is the message which comes from server and it should be display in muultiline. Here is the message which comes from server and it should be display in muultiline. Here is the message which comes from server and it should be display in muultiline. Here is the message which comes from server and it should be display in muultiline.", attributes: strAttributesMs)

    let alertController = UIAlertController(title: "", message: "", preferredStyle: .alert)
    alertController.setValue(alrtTitleStr, forKey: "attributedTitle")
    alertController.setValue(alrtMessage, forKey: "attributedMessage")

    let btnYes = UIAlertAction(title: "Yes", style: .default, handler: { action in
        //next process
    })
    let btnNo = UIAlertAction(title: "No", style: .default, handler: { action in
        //next process
    })

    alertController.addAction(btnYes)
    alertController.addAction(btnNo)
    self.present(alertController, animated: true, completion: nil)

UILineBreakMode*Truncation modes (leading/trailing "…") and , Word Wrapping and Truncation is not well managed. Today the OHAttributed does not support both multiline (numberOfLines>1) and "Truncation" to have the latest bugfixes and improvements… and the right warning messages. manage Tail Truncation, and only if the NSAttributedString does not have  It shows tail: messages.log: file truncated when the file gets truncated automatically and that's supposed to happen, but I just want tail to show me the output without this truncate message. I've tried using tail -f messages.log | grep -v truncated but it shows me the message anyway.

Solved If you write this type of code in your project then it's affected to some default properties of the alert controller. To remove this type of extension alert controller have default properties of multiline in swift 4

override open var intrinsicContentSize: CGSize {
    guard let text = self.text else { return super.intrinsicContentSize }

    var contentSize = super.intrinsicContentSize
    var textWidth: CGFloat = frame.size.width
    var insetsHeight: CGFloat = 0.0

    if let insets = padding {
        textWidth -= insets.left + insets.right
        insetsHeight += insets.top + insets.bottom
    }

    let newSize = text.boundingRect(with: CGSize(width: textWidth, height: CGFloat.greatestFiniteMagnitude),
                                    options: NSStringDrawingOptions.usesLineFragmentOrigin,
                                    attributes: [NSAttributedStringKey.font: self.font], context: nil)

    contentSize.height = ceil(newSize.size.height) + insetsHeight

    return contentSize
}

error_log - Manual, Notes ¶. Warning. error_log() is not binary safe. message will be truncated by null character. Tip. message  This is the code I am writing to display UIActionSheet. Clearly, second option is longer and thus the size gets smaller to accommodate the width. But I want the same font size for all the options which leaves me with multiline. Also tried with UIAlertController but not able to set multiline text.

Active Support Core Extensions, multiline? Extensions to Range. to_s; === , include? , and cover? overlaps? In order to have a near-zero default footprint, Active Support does not load Controllers need to be aware of any redefinition of to_param because when a The method truncate returns a copy of its receiver truncated after a given length :​  In MVC 4, you could install this package Twitter.bootstrap.mvc and this would add lots of HTML helpers. Once istalled you could send alert to view right from controller. For example: public class A

RSyslog Documentation, This sets the interval in which multi-line-read timeouts are checked. The syslog facility to be assigned to messages read from this file. There is intentionally no more precise description of when state files are being written, as this is an implementation This is consistent with other rsyslog control character escaping. Hi, Filling a form like Gmail registration, I want to display alert message box after saving the data, I think this can be done from Controller, so please any idea?

Groovy Language Documentation, A multiline comment starts with /* and can be found at any position in the line. A Class description */ class Person { /** the name of the person */ String name /** * Creates a @param otherPerson the person to greet * @return a greeting message */ String String if there's no interpolated expression, but are groovy.​lang. An example of an alert being generated can be seen below. SELinux Alert on the Gnome Desktop. To get a detailed description of why the alert was generated, you can click the Show link in the alert box. When you click the Show link, the following dialog box will appear. SELinux Alert Browser Dialog Box

Comments
  • FYI - UIAlertController has not public support for setting attributed title and message. That code could crash with any iOS update. Best to avoid such undocumented properties.
  • It works for me perfectly
  • @Sanjukta - it works for me also in the simple demo but in my project any property which will I set programmatically that to affect into that's I think so. Please correct me if I'm wrong. So is there any properly which effect.
  • @rmaddy: then how to change the alert title message color and font size. having any alternative solution.
  • @Vishal_Wagh it's pretty simple to write your own view controller to use instead of the system UIAlertController - then you will have full control over the formatting