Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

navigationItem.rightBarButtonItems

By: a guest on May 8th, 2013  |  syntax: None  |  size: 1.29 KB  |  views: 34  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. UIBarButtonItem* gamecenterButtonItem, *gamecenterButtonItem2 ;
  2.     {
  3.         UIImage* image1 = [UIImage imageNamed:TEX_GAMECENTER_BTN_1];
  4.         UIImage* image2 = [UIImage imageNamed:TEX_GAMECENTER_BTN_2];
  5.  
  6.         CGRect frame = CGRectMake(0, 0, image1.size.width, image1.size.height);
  7.  
  8.         UIButton *gcButton = [[UIButton alloc] initWithFrame:frame];
  9.         [gcButton setBackgroundImage:image1 forState:UIControlStateNormal];
  10.         [gcButton setBackgroundImage:image2 forState:UIControlStateHighlighted];
  11.    
  12.         gamecenterButtonItem = [[UIBarButtonItem alloc] initWithCustomView:gcButton];
  13.     }
  14.    
  15.     {
  16.         UIImage* image1 = [UIImage imageNamed:TEX_GAMECENTER_BTN_1];
  17.         UIImage* image2 = [UIImage imageNamed:TEX_GAMECENTER_BTN_2];
  18.  
  19.         CGRect frame = CGRectMake(30, 0, image1.size.width, image1.size.height);
  20.  
  21.         UIButton *gcButton = [[UIButton alloc] initWithFrame:frame];
  22.         [gcButton setBackgroundImage:image1 forState:UIControlStateNormal];
  23.         [gcButton setBackgroundImage:image2 forState:UIControlStateHighlighted];
  24.        
  25.         gamecenterButtonItem2 = [[UIBarButtonItem alloc] initWithCustomView:gcButton];
  26.     }
  27.  
  28.     self.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:gamecenterButtonItem, gamecenterButtonItem2, nil];