I'm trying to make my app use a dark theme, so far I've changed the style of navigation controllers and tab bar controller to Dark from the storyboard to get the system dark theme but when I tried to make my table views dark I wasn't able to find an equivalent option.
Am I missing something and there is an option, in storyboard or code, to make all UITableView
s use a system dark theme? If not, what is the best way to achieve this using default/standard colours?
I'm trying to achieve something similar to the Activity app that becomes available when you pair an Apple Watch:
There is no such thing as a "dark theme"... unless you create one yourself.
There are various ways that you can customise a UITableView
though...
The best place to find them is the Apple Documentation for UITableView .
You can change the backgroundColor
the cell colour the separator colour, etc, etc...
There is no implementation out of the box by Apple.
Here's a universal approach:
Make a Theme
class for UI configuration. It will hold several properties like UIColors/UIImages/SystemSoundIDs/Strings etc. depending on what you need.
You could also make a config json file
and make a theme parameters list for theme configuration. (this will make it easier to configure if you want to change smth fast or even receive a json config from server for example and configure the whole app)
Theme
object will take certain parameters or fields of a json file and configure fonts/colors/backgrounds/sizes etc.
You can make a method, something like class func applyThemeToViewController(vc: UIViewController, theme: Theme)
for configuring a certain screen or config something global through UIAppearence
proxy.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.