Putte
Putte

Reputation: 536

Set dark mode properties in swift

I've two questions about dark mode on iOS.

I got rejected from App Store because the UI looked bad in dark mode, so my questions is..

  1. Is it required to use dark mode on an iOS app with iOS 13?
  2. If it is required with dark mode, how can I set colors for a specific item? Parts of the app I'm using RGBa colors like the code below.

    btn_walk.tintColor = UIColor.init(red: 63/255, green: 236/255, blue: 201/255, alpha: 1)
    

So how can I get this color to look good in dark mode? And how can I set dark-mode colors for a specific item like a textview or label?

Thanks in advance.

Upvotes: 0

Views: 614

Answers (2)

Sajid Israr
Sajid Israr

Reputation: 124

its not mandatory to support dark mode. but for latest updates you need to fix it. the easy way is.

make a BaseViewController class and following method in.

- (void)viewDidLoad {
    [super viewDidLoad];

    if (@available(iOS 13.0, *)) {
        self.overrideUserInterfaceStyle = UIUserInterfaceStyleLight;
    } 
    // Do any additional setup after loading the view.
}

then inherit your ViewControllers / TableViewControllers with Base Controller. thats it.

Upvotes: 0

D. Greg
D. Greg

Reputation: 1000

You don't need to support Dark Mode. To force your app to be displayed in Light Mode, in your .plist file add User Interface Style as type String and set it to Light enter image description here

You can always remove this once you've set up a Dark Mode UI

Upvotes: 3

Related Questions