2

I have an application that uses "_placeholderLabel" UITextField property and changes to UILabel adjust UILabel Font size according to the given width. I am attaching below code that works for all iOS lower than 13 but for iOS 13 it crashing while fetching the _placeholderLabel property.

if #available(iOS 13.0, *) 
{
/// iOS 13 code for adjust fonts
} else {
 (txtSearchField.value(forKey: "_placeholderLabel") as! UILabel).adjustsFontSizeToFitWidth = true
}
jogshardik
  • 1,446
  • 1
  • 12
  • 23
  • you can directly call `txtSearchField.adjustsFontSizeToFitWidth = true` – Anbu.Karthik Oct 18 '19 at 12:44
  • 1
    see this for help :[Xcode 11 Beta - iOS 13 Simulator - UITextField with Placeholder getting app crash](https://stackoverflow.com/questions/56526966/xcode-11-beta-ios-13-simulator-uitextfield-with-placeholder-getting-app-cras) – Anbu.Karthik Oct 18 '19 at 12:51
  • @Anbu.Karthik Thanks!! I use Ivar solution, that works for me. – jogshardik Oct 18 '19 at 13:02

0 Answers0