candostdagdeviren / CDAlertView

Highly customizable alertview and alert/notification/success/error/alarm popup written in Swift
https://candostdagdeviren.github.io/CDAlertView/
MIT License
1.14k stars 86 forks source link

Message in alert is getting truncated #29

Closed Kalikanth closed 6 years ago

Kalikanth commented 6 years ago

In my app presenting an alert but the message getting truncated to one line

let alert = CDAlertView(title: title, message: message, type: CDAlertViewType.error)
let okay = CDAlertViewAction(title: "OK", font: nil, textColor: nil, backgroundColor: nil) { (action) in
}
alert.add(action: okay)
alert.show()

screen shot 2017-11-06 at 9 16 06 pm

candostdagdeviren commented 6 years ago

Hello @Kalikanth, thanks for the issue! Which iOS and CDAlertView version do you use?

Kalikanth commented 6 years ago

@candostdagdeviren I'm using the latest version of CDAlertView (swift 4)and device is iPhone 6(11.0) xcode 9.1

Kalikanth commented 6 years ago

What may be the issue. In other projects Default UIAlertController is working fine but after removing the CDAlertView. The UIAlertController also started truncating. How to overcome this please help this is very urgent.

candostdagdeviren commented 6 years ago

simulator screen shot - iphone 6 - 2017-11-07 at 07 01 03

I tried your code on iPhone 6, iOS 11.1 and it's working. Do you do extra customizations or something else that can override UILabel's numberOfLines property?

Kalikanth commented 6 years ago

i didn't do any customizations i'm not getting what's the problem what i obeserved is UILabels text is also getting truncated. How can set the this to default of UILabel

candostdagdeviren commented 6 years ago

as you can see in here for message label: https://github.com/candostdagdeviren/CDAlertView/blob/master/CDAlertView/Classes/CDAlertView.swift#L578

and here for title label: https://github.com/candostdagdeviren/CDAlertView/blob/master/CDAlertView/Classes/CDAlertView.swift#L569

We set numberOfLines to 0. It shouldn't truncate. Do you have any extension of UILabel that can override this or something else which can cause this? Because I'm not able to reproduce the bug. Maybe you don't do any customizations for CDAlertView but you may customize UILabel's properties or something else. This is the only thing that comes to my mind.

Kalikanth commented 6 years ago

Yeah! I got the issue i was overriding the UILabel Property that is the reason for this strange behaviour. Thank you @candostdagdeviren

candostdagdeviren commented 6 years ago

Good to see that you've solved! Closing the issue :)