3

I create an app in XCode 10.2. Currently, Apple released a new OS version 13.2.3, I update ios Version in a real device and I check my app in the real device. not displaying text in my textField How to fix this. enter image description here

Anybody can help me.

Pranav Kasetti
  • 8,770
  • 2
  • 50
  • 71
Nikunj
  • 655
  • 3
  • 13
  • 25

2 Answers2

4

If your app not supporting Dark Mode:-

you can Disable dark mode in your entire app by adding the following key-value in your Info.Plist.

UIUserInterfaceStyle =  Light

If your app supporting Dark Mode:-

In iOS 13 Dark mode Your Text color will not be visible. If you didn't set it. If you assign System colors dark mode and light colors will change automatically.

@IBOutlet weak var textFeild: UITextFeild!
 override func viewDidLoad() {
        super.viewDidLoad()
      if #available(iOS 13.0, *) {
                textFeild.textColor = .label // System Color
            } else {
                // Fallback on earlier versions
              textFeild.textColor = .black
            }
}

or For custom colors, you can use callback method in UIColor

@IBOutlet weak var textFeild: UITextFeild!
 override func viewDidLoad() {
        super.viewDidLoad()
                if #available(iOS 13.0, *) {
                     let dynamicColor = UIColor { (traitCollection: UITraitCollection) -> UIColor in
                         if traitCollection.userInterfaceStyle == .dark {
                            return darkColor
                         } else {
                            return lightColor
                         }
                     }
                    UILabel().textColor =  dynamicColor
                 } else {
                     // Fallback on earlier versions
                UILabel().textColor =  lightColor
                 }
}

You can set this in storyboard itself.

enter image description here

Community
  • 1
  • 1
Manikandan
  • 1,195
  • 8
  • 26
2

Change the appearance of your device to a light mode and see if the problem is solved. If yes, then you should set the textColor of the text relative to the given appearance mode.

You can add new Color Set in Assets.xcassets, like this:

enter image description here

and the color will change automatically relative to the selected appearance mode.

Hope this will help you!

kzakharc
  • 499
  • 2
  • 8