Some labels and UITextfiled and it's text becoming black automatically when selecting Dark Dode - swift5

I am migrated my all code to swift 5 and Xcode 11 recently,
My app works fine for iOS versions below 13.0 but when I chose Dark Mode, the labels are going black, some textfields and it's text automatically shown black, all of has white background and app theme is in white background and it is very hard to reset it from storyboard.
Anyone has any trick to do it in app delegate or in viewdidload to turn off the dark mode for this particular app? I don't want to take the facility of dark mode right now.

Yes you can do it in one line of code to eliminate the dark mode entirely by setting the UserInterfaceStyle on main window:
window!.overrideUserInterfaceStyle = .light
or you can do it in
if #available(iOS 13.0, *) {
window!.overrideUserInterfaceStyle = .light
}

Related

Links showing in red instead of blue?

When I use the canvas view, my app has normal blue links in both dark and light themes. However, when I run it in the simulator or on any test device, they are red instead of blue, in both light and dark themes. What the heck is going on?!?
I'm using latest version of everything, and I've tried it on multiple sim devices and physical devices. This is present on every screen in my app.
Turns out my co-developer had added an override in the AppDelegate that was changing the text colors. Removing that fixed the issue.

iOS 10 GMSMapView showing my location icon with white background

This issue didn't show up in previous iOS versions. But in iOS 10 beta, the user location icon is displayed wrong. The blue dot is showing its frame in a different background instead of clearColor.
Is this an issue with iOS10? Any workaround to set the background color of the blue icon ?
I know we can put a custom icon by setting the blue dot to NO and:
GMSMarker *pointMarker = [GMSMarker markerWithPosition:currentPosition];
pointMarker.icon = [UIImage imageNamed:#"YourImage"];
pointMarker.map = _map;
IS there any other way to set the background of user location to clear color ?
This sometimes happen in the Simulator, I've seen it on older iOS versions.
If this happens on the device then it's a bug.

How to change the background color of keypad in iOS 7

I am using Xcode 5 for developing applications. I want to change the color of keyboard in iOS 7. I want a color like black or blue.
How can I change the color of keyboard in iOS 7?
You can only set the keyboard appearance to any of three listed below using the UIKeyboardAppearance.
UIKeyboardAppearanceDefault // Corresponds to the UIKeyboardAppearanceLight
UIKeyboardAppearanceDark // Available in iOS 7.0 and later.
UIKeyboardAppearanceLight // Available in iOS 7.0 and later.
There is one more constant named UIKeyboardAppearanceAlert but, that is now deprecated. You should use UIKeyboardAppearanceDark instead.
You can't use any custom or undefined color.
So, Use ...
myTextfield.keyboardAppearance = UIKeyboardAppearanceDark;
In iOS 7, since the keyboard is translucent, I was able to accomplish this effect by adding a colored subview behind the keyboard that shows and hides with keyboard notifications.
I created a GitHub project to demonstrate this technique. Keep in mind it only works in portrait orientation right now and obviously only in iOS 7.
https://github.com/meekapps/TintedKeyboard
You can change the color with the keyboardAppearance method.
_textField.keyboardAppearance = UIKeyboardAppearanceDark;
Have a look at the Apple API docs
Per your comment of wanting a custom color:
You could do this... Just use the normal keyboard, then observe UIKeyboardWillShowNotification and UIKeyboardWillHideNotification so that you can show a color UIView behind the keyboard.
It would be hacky, but it would work because the default keyboard is transparent to a degree on iOS 7.
Good luck.

Why are disabled UISegmentedControl segments drawn incorrectly on iOS 4.0+?

For some strange reason, on iOS 4.2.1 (and any iPhone OS after 4.0), using a UISegmentedControl as a UIBarButtonItem in a toolbar will leave disabled segments drawn incorrectly, like this:
The text is displayed in dark gray, but should resemble the disabled state of the disabled "Login" button in the upper right. I'm using a standard UISegmentedControl, not a subclass.
Is there any way to get around this bug?
UPDATE: It's definitely not supposed to look that way and is probably a regression indroduced in iOS 4.0. Here's how it looks on 3.1.3:

iPhone UIDatePicker Gradient - What are the colors?

I'm putting in a UIDatePicker in a UIView and I can see that the UIDatePicker has a border that is some kind of a dark color on the bottom and it gets lighter as you get higher. I want the containing UIView to use the same colors so that the UIDatePicker flows with the rest of the view and doesn't stand out.
I can put in a gradient in the containing view, but I don't know what colors to use! If anyone could suggest them, I'd appreciate it.
mj
Light Color (Top): RGB: 145,146,154
Dark Color (Bottom): RGB: 30,31,44
Use Digital Color Meter that is built-in to OS X (in the Utilities folder).
The colours displayed in Xcode don't always match those when the app is viewed on an actual iOS device, especially for UIDatePicker object.
What I've found useful is the following:
Run the app on an iOS device with your objects on screen
Take a screenshot (hold down the home button and the power button together)
Email that screenshot to your Mac
Use the OS X Digital Color Meter on the screenshot to get accurate RGB values
Remember to check both retina and non retina devices for colour matching.