-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Theme Methods
With Chameleon, you can now specify a global color theme with simply one line of code (It even takes care of dealing with the status bar style as well)! Here's one of three methods to get you started. ContentStyle
allows you to decide whether text and a few other elements should be white, black, or whichever contrasts more over any UI element's backgroundColor
.
To set a global theme, you can do the following in your app delegate:
[Chameleon setGlobalThemeUsingPrimaryColor:(UIColor *)color withContentStyle:(UIContentStyle)contentStyle];
But what if you want a different theme for a specific UIViewController?
No problem, Chameleon allows you to override the global theme in any UIViewController
and UINavigationController
, by simply doing the following:
//This would go in the controller you specifically want to theme differently
[self setThemeUsingPrimaryColor:FlatMint withSecondaryColor:FlatBlue andContentStyle:UIContentStyleContrast];
Note: In order for the status bar style to automatically be set using a theme, you need to make sure that the View controller-based status bar appearance key in Info.plist is set to NO
.
As of 2.0.3
the navigation bar hairline view is no longer hidden by default. However, if you're seeking a true flat look (like the image above), you can hide the hairline at the bottom of the navigation bar by doing the following:
[self.navigationController setHidesNavigationBarHairline:YES];
//or
self.navigationController.hidesNavigationBarHairline = YES;
self.navigationController?.hidesNavigationBarHairline = true