Change Tint/Background colour of iOS controls without using images

Is it possible using the UIAppearance proxy (in iOS 5) to change the background colour of iOS Elements, specifically the tab bars and title bars without using images?

I'd like to use a deep green gradient, but without using images. Is it possible to do so in both iOS 5 and below?


Well you're asking two different questions here, but if you want to simply change the tint color it can be done like this...

self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:255 green:0 blue:0 alpha:1];
self.tabBarController.tabBar.tintColor = [UIColor colorWithRed:255 green:0 blue:0 alpha:1];

Additionally, if you wish to use a gradient this is possible to do without imagery, but is best done with a tiled image...

self.navigationController.navigationBar.tintColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"myGradient.png"]];
self.tabBarController.tabBar.tintColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"myGradient.png"]];

Heh, now in iOS6 you can now add UIStatusBarTintParameters key to Info.plist.

From the iOS6 GM changelog:

It is now possible to set status bar tint parameters in your app's Info.plist file. You might do this to ensure that the status bar color matches your app’s navigation bar color during startup. To set the status bar tint, add the UIStatusBarTintParameters key to your Info.plist file. The value of this key is a dictionary with the appropriate values describing the navigation bar your app has at startup. Inside the dictionary should be the UINavigationBar key, which has a value that is also a dictionary. That dictionary contains the initial navigation bar’s style (with the Style key) and indicates whether it is translucent (with theTranslucent key). You can also specify your navigation bar’s tint color (with the TintColor key) or the name of its custom background image (with the BackgroundImage key).

Need Your Help

Interface Segregation Principle- Program to an interface

oop design-patterns solid-principles interface-segregation-principle

I was reading about SOLID and other design principles. I thought ISP was the same as "Program to an interface, not an implementation". But it looks like these are different principles?

C# memory allocation

c# new-operator allocation operator-keyword

Does using operator new in c# might fail (if it requires a large memory for example)? -Solved-