Advertisement
julong

Layout design UI/UX UINavigationbar

Feb 27th, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. *
  3. *    EAKKASIT TUNSAKOOL
  4. *
  5. */
  6. /*
  7. FONT
  8.  
  9. UITextAttributeFont – Key to the font
  10. UITextAttributeTextColor – Key to the text color
  11. UITextAttributeTextShadowColor – Key to the text shadow color
  12. UITextAttributeTextShadowOffset – Key to the offset used for the text shadow
  13.  
  14. */
  15. /*/////////////////////////////////////////////////////////////////////////////////////////
  16. *
  17. *
  18. //appdelegate.m
  19. //Color
  20. 1) define at the #define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
  21.  
  22.     [[UINavigationBar appearance] setBarTintColor:UIColorFromRGB(0xfa2371)];
  23.  
  24.  
  25.  
  26. /*/////////////////////////////////////////////////////////////////////////////////////////
  27. *
  28. *  Backgound Image
  29. */
  30.     //[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"bg_hear_bar.png"] forBarMetrics:UIBarMetricsDefault];
  31.  
  32.  
  33.  
  34. /*/////////////////////////////////////////////////////////////////////////////////////////
  35. *
  36. *  Font
  37. */
  38.     NSShadow *shadow = [[NSShadow alloc] init];
  39.     shadow.shadowColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8];
  40.     shadow.shadowOffset = CGSizeMake(0, 1);
  41.     [[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
  42.                                                            [UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1.0], NSForegroundColorAttributeName,
  43.                                                            shadow, NSShadowAttributeName,
  44.                                                            [UIFont fontWithName:@"HelveticaNeue-CondensedBlack" size:21.0], NSFontAttributeName, nil]];
  45.  
  46.  
  47. /*/////////////////////////////////////////////////////////////////////////////////////////
  48. *
  49. *  Customizing the Color of Back button
  50. */
  51. //
  52.     [[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
  53.  
  54.  
  55. /*/////////////////////////////////////////////////////////////////////////////////////////
  56. *
  57. *   Custom image to replace the default chevron
  58. */
  59. //    
  60.  
  61.     [[UINavigationBar appearance] setBackIndicatorImage:[UIImage imageNamed:@"back_btn.png"]];
  62.     [[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:[UIImage imageNamed:@"back_btn.png"]];
  63.    
  64. /*/////////////////////////////////////////////////////////////////////////////////////////
  65. *
  66. *   Use Image as Navigation Bar Title
  67. */
  68.     //
  69.     //self.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"appcoda-logo.png"]];
  70.  
  71.  
  72. /*/////////////////////////////////////////////////////////////////////////////////////////
  73. *
  74. *  Icon system
  75. */
  76. /*delegate.h*/
  77. 1) define at the delegate.h  
  78. @property(copy,nonatomic)UINavigationItem *navigationItem;
  79. @property(nonatomic, copy) NSArray *rightBarButtonItems;
  80.  
  81. /*controller.m*/
  82. 2) Icon system
  83. //Adding Multiple Bar Button Items
  84.     UIBarButtonItem *shareItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:nil];
  85.     UIBarButtonItem *cameraItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCamera target:self action:nil];
  86.     UIBarButtonItem *test = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemCompose target:self action:nil];
  87.     NSArray *actionButtonItems = @[shareItem, cameraItem,test];
  88.     self.navigationItem.rightBarButtonItems = actionButtonItems;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement