Advertisement
Guest User

Changing the NavBar Appearance

a guest
May 25th, 2017
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. //set the back arrow and other icons to the title text color for iOS7...
  2. if(floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1){
  3. [self.navigationController.navigationBar setTintColor:[BT_color getColorFromHexString:[appDelegate navBarTitleTextColor]]];
  4. }
  5.  
  6. //////// end setup nav bar
  7. /////////////////////////////////////////
  8. NSShadow *shadow = [[NSShadow alloc] init];
  9. shadow.shadowColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8];
  10. shadow.shadowOffset = CGSizeMake(0, 1);
  11. UIColor *myColor = [BT_color getColorFromHexString:@"#6D6C3A"];
  12.  
  13. NSDictionary *textola = [NSDictionary dictionaryWithObjectsAndKeys:
  14. myColor, NSForegroundColorAttributeName,
  15. shadow, NSShadowAttributeName,
  16. [UIFont fontWithName:@"AmericanTypewriter" size:21.0], NSFontAttributeName, nil];
  17.  
  18. [self.navigationController.navigationBar setTitleTextAttributes:textola];
  19.  
  20. UILabel* tlabel=[[UILabel alloc] initWithFrame:CGRectMake(0,0, 200, 40)];
  21. tlabel.text=navBarText;
  22. tlabel.textAlignment = NSTextAlignmentCenter;
  23. tlabel.textColor=[BT_color getColorFromHexString:@"#6D6C3A"];
  24. tlabel.font = [UIFont fontWithName:@"AmericanTypewriter" size: 21.0];
  25. tlabel.adjustsFontSizeToFitWidth=YES;
  26. self.navigationItem.titleView=tlabel;
  27.  
  28.  
  29. //tell iOS7 the top bar needs updated..
  30. if(floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1){
  31. [self setNeedsStatusBarAppearanceUpdate];
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement