title: Which event get called when we hit UISearchBar
body: <p>In my application, I need to do some activity i.e pushing otherview controller,when I click a UISearchbar which is added on view.</p>
  
  <p>what is best approach to achive this.</p>
  
  <p>As one of thing is when we click UISearchbar "searchBarTextDidBeginEditing" get fired,but with my scenario when I push view controller in "searchBarTextDidBeginEditing" and come back searchBarTextDidBeginEditing get called again, so seems it is not ideal place to push view controller.</p>
  
  <p>This is maincontroller</p>
  
  <pre><code>// Search bar
    iSearchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, 40)];
    iSearchBar.delegate = self;
    iSearchBar.showsCancelButton = NO;
    iSearchBar.autocorrectionType = UITextAutocorrectionTypeNo;
    iSearchBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
    [self addSubview:iSearchBar];
  </code></pre>
  
  <p>when I click UISearchBar then it calls</p>
  
  <pre><code>   - (void)searchBarTextDidBeginEditing:(UISearchBar*)searchBar
     {
     [self ShowMySearch];
     }
  </code></pre>
  
  <p>In ShowMySearch , I am pushing some other controller lets say searchcontroller and when pop this searchcontroller and come back to maincontroller 
   "searchBarTextDidBeginEditing" get call again and searchcontroller is pushed again and causing issue. this behavior is seen only on 3.1.1</p>
  
  <p>Thanks,</p>
  
  <p>Sagar</p>