title: UIBarButtonItem init with custom view selector not working properly
body: <p>I'm trying for hours to make a left button work properly and mimic a back button.</p>
  
  <p>My code to create the button:</p>
  
  <pre><code>UIBarButtonItem *backButton = [self customBarButton:@"back_button" imageHiglighted:@"settings_button_highlighted" x:20 y:0 widthDivider:2.6 heightDivider:2.6];
  
  backButton.target = self;
  backButton.action = @selector(buttonPressed:);
  
  self.navigationItem.leftBarButtonItem = backButton;
  </code></pre>
  
  <p>Here the method called to create custom button:</p>
  
  <pre><code>- (UIBarButtonItem *)customBarButton:(NSString *)imageDefault imageHiglighted:(NSString *)imageHighlighted x:(float)x y:(float)y widthDivider:(float)widthDivider heightDivider:(float)heightDivider {
  
  UIImage *customImageDefault = [UIImage imageNamed:imageDefault];
  UIImage *customImageHighlighted = [UIImage imageNamed:imageHighlighted];
  
  CGRect frameCustomButton = CGRectMake(x, y, customImageDefault.size.width/widthDivider, customImageDefault.size.height/heightDivider);
  
  UIButton *customButton = [[UIButton alloc] initWithFrame:frameCustomButton];
  
  [customButton setBackgroundImage:customImageDefault forState:UIControlStateNormal];
  [customButton setBackgroundImage:customImageHighlighted forState:UIControlStateHighlighted];
  
  UIBarButtonItem *barCustomButton =[[UIBarButtonItem alloc] initWithCustomView:customButton];
  
  return barCustomButton;
  
  }
  </code></pre>
  
  <p>And the action:</p>
  
  <pre><code>-(void)buttonPressed:(id) sender{
  
      NSLog(@"Entered");
      SearchViewController *ViewController = [[SearchViewController alloc] init];
      [self.navigationController pushViewController:ViewController animated:YES];
  
  }
  </code></pre>
  
  <p>So I was able to make it with a simple UIButton but not with a UIButtonBarItem and I really don't know what's going on with it. </p>
  
  <p>If you could help me I'd be very grateful.</p>
  
  <p>Thanks.</p>