Suggestions needed for application dark mode ios - ios

I am making a dark mode setting for my app.
Currently, the dark mode is nearly working on a single scene. While adding the dark mode though, I noticed that I need a lot of IBOutletCollection to properly change the colors that I want (ex. labels should become white, background black, the title should be a very dark gray...).
Now, this seems inefficient and time consuming. Isn't there a way to load everything, for() it, and set the correct color for each specific object? (If there is, how?)

UIAppearance is what you are looking for, it’s meant to be used for changing the appearance of a class https://developer.apple.com/documentation/uikit/uiappearance?language=objc
For example a label would be styled like this:
[[UILabel appearance] setTextColor: [UIColor whiteColor]];
See also related question on how to do the actual switching of the themes Using UIAppearance and switching themes

Related

Magic behind views automatically adapting to ios13 dark mode?

I found it quite weird that for new projects created by xcode 11 beta, common views like UILabel, UIButton in a storyboard can automatically adapt themselves to system theme changes without any code. But for my old projects still using XIB, even though all colors are set to default, they dont change when system theme changed, i still have to manually override traitCollectionDidChange and assign them system default values in order to make them change! What am i doing wrong? thanks.
I figured out. The magic is the newly added system colors to UIColor on ios 13, for example, UIColor.systemBackgroundColor, it will be white in light mode and black in dark mode, once you assign a system color to a property, it always updates itself based on system theme. So i guess UIViews created in xcode 11 beta storyboards automatically have system colors on.

Application NightTime Mode

I have just finished creating my first application and would like to add some additional customisations to it. That is, in my settingsViewController I have added a switch which allows to set the colours to a nighttime mode. My questions is how can I actually get my application to do this.
Thanks in advance for your responses.
You can't expect this thing to be handled by iOS itself because its an app feature that you will have to implement.
You can change background colors to dark and all those UILabel UIButton UITextView dark colored as well to have a feature called dark mode(Dark theme) upon user selection.

iOS custom keyboard blur view as background

This is really simple, but maybe not easy?
I'm trying to build a custom keyboard app for iOS, and so far I've made a concept work pretty well. But I really want to have the whole container/background view to be a blur view (frosted glass effect built in iOS), much like the system keyboard. It's very subtle, but I really want that effect.
Any idea how to apply it? Help!
One solution I found (which is great but not ideal) is to simply set the background color of the ViewController to transparent. By giving it a color with alpha = 0, it has the same color as the system keyboard background.
But this doesn't let you go any further in terms of transparency, so the blur is very subtle.

How to access the system selected menu item blue color?

I'm working on an app that has a custom NSView on a NSStatusBar which performs all of the drawing when the user clicks it. But here's the problem, the color I'm currently drawing as the view's background color is not the same as the system blue color.
My app's color:
Twitter's menu item color (system):
As you clearly see, my blue color is way lighter than the system. This is the code I'm currently using (and worked perfectly on versions older than Yosemite):
[[NSColor selectedMenuItemColor] set];
NSRectFill(rect);
I've even tried color picking the menu item's color but it seems like the color is affected by the wallpaper below the menu bar.
Any ideas on how to achieve the system look?
As you said, in Yosemite, docks, status bars etc. are affected by whatever is behind them. Try enabling System Preferences > Accessibility > Display > Reduce Transparency and you'll see what your color looks like without this feature./
Here is an idea - Maybe you should use the Vibrancy effect and derive from NSVisualEffectView. I knew that I've seen a very similar thread somewhere here in the past, and it took me quite some time to find it. Here it is:
Trouble matching the vibrant background of a Yosemite NSMenuItem containing a custom view
I think Matthes' answer to that question would lead you to the resolution of your issue. Be sure to check it out. I hope it will help - Good luck and report back!

iPhone App Appearance Swap?

In my app I want to have an option available so that the user can alter the appearance of the app. This would simply be the visual style -- navigation bar, cell, font, and button images.
The user hits a button and then the app loads in the appropriate images or whatever.
What are the ways to approach this?
In iOS 5 and later you can use the UIAppearance class method appearance, which returns the appearance proxy for the receiver, and set it there. For instance, if you wanted to make all UIView background colors green, you would simply say:
[[UIView appearance] setBackgroundColor:[UIColor greenColor]];
This would, of course, only be good for the single user session. Once the app quit, you'd be back to white or whatever background color you set as the default.
The comment suggesting this SO question: Best way to apply a theme to an iPhone app provides a much more in-depth answer, and is probably more along the lines of what you're looking for.

Resources