Skip to main content

Posts

Showing posts from May, 2012

Color status bar on iPhone

This is just a quick tip with some basic logic on how to get a colored status bar on an iphone app ,here i will be assuming that the app does not rotate so i will be placing all the code in appdelegate in the
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
So the secret is really that there is no secret ,apples framework does not allow you to choose the color of the status bar so instead we set the status bar to the translucent  predefined style of UIStatusBarStyleBlackTranslucent and then we draw a colored view behind it to make it appear as though the color of the bar has changed. Here is a sample where i "tinted" the statusbar cyan in the app delegate :

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {         [[UIApplicationsharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucentanimated:NO]; UIView *colorStatBar = [[UIViewalloc] initWithFram…