Skip to content

Instantly share code, notes, and snippets.

@JigarM
Last active August 29, 2015 14:14
Show Gist options
  • Save JigarM/b2b1f76d23921d5b2ca8 to your computer and use it in GitHub Desktop.
Save JigarM/b2b1f76d23921d5b2ca8 to your computer and use it in GitHub Desktop.
Customize navigationbar
/*****************************************************/
//Customizing Navigation Bar and Status Bar in iOS 7
//http://www.appcoda.com/customize-navigation-status-bar-ios-7/
/*****************************************************/
NSShadow *shadow = [[NSShadow alloc] init];
shadow.shadowColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8];
shadow.shadowOffset = CGSizeMake(0, 1);
[[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
[UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1.0], NSForegroundColorAttributeName,
shadow, NSShadowAttributeName,
[UIFont fontWithName:@"HelveticaNeue-CondensedBlack" size:20.0], NSFontAttributeName, nil]];
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
UIColor *barColor = [UIColor colorWithRed:189.0/255.0 green:40.0/255.0 blue:61.0/255.0 alpha:1.0];
[[UINavigationBar appearance] setBarTintColor:barColor];
/*****************************************************/
//Empty back button in iOS 7
//http://www.fousa.be/blog/empty-back-button-in-ios-7
/*****************************************************/
//[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(-1000, -1000) forBarMetrics:UIBarMetricsDefault];
/*****************************************************/
//Transparent navigation bar
//http://stackoverflow.com/questions/20319439/how-to-make-navigation-bar-transparent-in-ios-7
/*****************************************************/
[[UINavigationBar appearance] setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
[[UINavigationBar appearance] setShadowImage:[UIImage new]];
[[UINavigationBar appearance] setTranslucent:YES];
/*****************************************************/
//Changing the Style of Status Bar
/*****************************************************/
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment