title: How to use UISearchBar as input accessory view?
body: <p>I'm trying to use a UISearchBar as an input accessory view so that it can animated present together with keyboard, my first solution is,</p>
  
  <ol>
  <li>Creates a new class MySearchBar which extends UISearchBar and implements inputAccessoryView property from UIResponder.</li>
  <li>In my view controller, I create a new MySearchBar instance named mySearchBar, and <strong>set its inputAccessoryView to be itself</strong> (this creates circular reference, but I have the code to break it).</li>
  <li>Each time I want to present the search bar, I first add it to controller's view, and call its becomeFirstResponser method.</li>
  <li>After the keyboard presents, calls [[mySearchBar inputAccessoryView] becomeFirstResponser].</li>
  </ol>
  
  <p>This works very well on my iPhone 4 with iOS 4.3.  However, on iPhone 5.0 simulator the keyboard doesn't show up only after I tap on the search bar (see the image below).</p>
  
  <p><img src="https://i.stack.imgur.com/8kjHg.png" alt=""></p>
  
  <p>Then I try my second solution,</p>
  
  <ol>
  <li>Creates a new class named MyTextField which extends UITextField, in the implementation creates a UISearchBar and use it as input accessory view of MyTextField.</li>
  <li>In my view controller class I add a dummy MyTextField to the view hierarchy.</li>
  <li>Each time I want to present the search bar, I simply call [myTextField becomeFirstResponser].</li>
  <li>After the keyboard presents, calls [[myTextField inputAccessoryView] becomeFirstResponser].</li>
  </ol>
  
  <p>With this solution I have no problem presenting keyboard, and focusing on the input accessory view (the search bar), however, I cannot input any text when the search bar is being focused.</p>
  
  <p>Anyone know what's going wrong?
  Thanks!</p>