Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

All the alert dialog message and textField have been changed to single line. Please checkout the image

Previously all the dialog and textField are working well. But not I do not know how these TextFields are suddenly changed to single line with triple. (Like some Message here...)

    let alert = UIAlertController(title: "Cancel Booking !!", message: "Are you sure you want to cancel your booking?", preferredStyle: .alert)
    alert.addAction(UIAlertAction(title: "No", style: .default, handler: nil))
    alert.addAction(UIAlertAction(title: "Yes", style: .default, handler: self.cancelMessageDialog))
    self.present(alert, animated: true, completion: nil)

Demo 1 Demo 3

like image 630
jazzbpn Avatar asked Sep 14 '17 06:09

jazzbpn


2 Answers

I had the same problem and solved it after 3 days and nights. Since the UIAlertViewController uses UILabel to show the message, I was firmly searching all over the project for something modifying the UILabel. I realized that no search result includes anything from some pods that definitely has "label" keywords in their function names and such. I decided to download the source codes for all of the pods from their repositories and searched recursively inside them with another simple text editor and voila! Some guy decided to override the default UILabel class instead of subclassing it in their pod. The culprit lines were

extension UILabel { ... override open func draw(_ rect: CGRect) { ... } override open var intrinsicContentSize: CGSize { ... } ... }

These did not show up in the search results by using the search function in XCode as I searched for UILabel extensions to begin with. So, I recommend you to open any 3rd party framework's source codes in your project and search inside them separately. There is most definitely something messing with the UILabel class.

like image 173
Batuhan C. Avatar answered Nov 14 '22 21:11

Batuhan C.


Add line break characters (\n) to your message.

like image 35
tania_S Avatar answered Nov 14 '22 22:11

tania_S