title: UISearchBar delegate not responding to cancel button
body: <p>I have a <code>UIViewController</code> that is a <code>UISearchBarDelegate</code> and a <code>MKMapViewDelegate</code>. The <code>searchBarSearchButtonClicked</code> event works fine, but when testing in iOS 4.2 the searchBarCancelButtonClicked never gets called when hitting the cancel button. In 4.3 everything works fine. I have other views with identical code and it works fine. I have triple checked the method signatures. </p>
  
  <p>Could it be something to do with the MapView, or am I doing something blatantly wrong?</p>
  
  <p>My .h file:</p>
  
  <pre><code>@interface MyViewController : UIViewController &lt;UISearchBarDelegate,MKMapViewDelegate,UIAlertViewDelegate&gt;{
  MKMapView *mapMainView;
  UISearchBar *sBar;
  
  }
  
  @property (nonatomic, retain) UISearchBar *sBar;
  @end
  </code></pre>
  
  <p>And I create the search bar like so:</p>
  
  <pre><code>sBar = [[[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320.0, 70.0)] autorelease];
  sBar.delegate = self;
  sBar.showsCancelButton = YES;
  [self.view addSubview:sBar];
  [sBar becomeFirstResponder];
  </code></pre>
  
  <p>The method:</p>
  
  <pre><code>- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar
  {
  [searchBar resignFirstResponder];
  searchBar.hidden = YES;
  }
  </code></pre>
  
  <p>Does anyone have an idea of why this may be happening?</p>