title: How to give a custom view for the UIBarButtonItem that is shown on portrait mode for UISplitViewController?
body: <p>When we go portrait mode while using a UISplitViewController, they will provide us by a barButtonItem. How can I use a customView for that barButtonItem? </p>
  
  <p>I tried the following way. It works if I start with portrait orientation. But if I go landscape and when I come back it crashes.</p>
  
  <p>In viewDidLoad</p>
  
  <pre><code>UIImage *image = [UIImage imageNamed:@"home.png"];
  UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
  button.bounds = CGRectMake(0, 0, 22.00, 22.00);    
  [button setImage:image forState:UIControlStateNormal];
  [button addTarget:self action:@selector(showHomeDetails) forControlEvents:UIControlEventTouchDown];    
  homeButton = [[UIBarButtonItem alloc] initWithCustomView:button];
  [button release];
  </code></pre>
  
  <p>Then in willHideViewController</p>
  
  <pre><code>barButtonItem = homeButton;
  </code></pre>
  
  <p>What shud I do? OR is there an alternate solution?</p>