0

Actually I added two button (UIButtonBarItem) and assigned it to to NavigationItem's rightbarbuttonitem but only edit button is visible and add button is not visible but when we click on it it gets invoked ? chk it out my code http://pastebin.com/Ew4zPEUz

Shobhakar Tiwari
  • 7,862
  • 4
  • 36
  • 71

2 Answers2

2

Try using this code in ViewDidload method

UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(0,0,60,30);
[button setImage:[UIImage imageNamed:@"iPhoneBackButton.png"] forState:UIControlStateNormal];
[button addTarget:self action:@selector(back:) forControlEvents:UIControlEventTouchUpInside];

UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button];
self.navigationItem.rightBarButtonItem=barButtonItem;
indyfromoz
  • 4,045
  • 26
  • 24
Rushi trivedi
  • 737
  • 1
  • 15
  • 37
0

finally solved this problem .

just removed below line

  self.navigationItem.rightBarButtonItem.tintColor=[UIColor clearColor] 

and its works :)

Rahul Patel
  • 5,858
  • 6
  • 46
  • 72
Shobhakar Tiwari
  • 7,862
  • 4
  • 36
  • 71