8 Replies
      Latest reply on Mar 23, 2018 7:04 AM by hpsinghmca
      rodrigomarcal Level 1 Level 1 (0 points)

        The alerts in my app are displayed, but they truncate the text. (both title and message)

         

        If i copy the same code and put it on a new project, all text is displayed.

        Because of this I think I changed some project configuration, but I dont know how...

         

        Can anyone helpe me?

         

        The code:

         

        func showMessage(title:String,message:String,view:UIViewController) {
        
            let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
            let action = UIAlertAction(title: "Ok", style: .default, handler: nil)
            alert.addAction(action)
        
            let color = self.defaultColor()
        
            alert.setValue(NSAttributedString(string: title, attributes: [NSFontAttributeName : UIFont.boldSystemFont(ofSize: 18),NSForegroundColorAttributeName : color]), forKey: "attributedTitle")
        
            alert.setValue(NSAttributedString(string: message, attributes: [NSFontAttributeName : UIFont.systemFont(ofSize: 15),NSForegroundColorAttributeName : color]), forKey: "attributedMessage")
        
            alert.view.tintColor = UIColor.black
        
            view.present(alert, animated: true, completion: nil)
        
        }