views:

53

answers:

1

I have a uisearchbar at the top of a uitableview

I have a button which I would like to be able to scroll to the top of the table (thus bringing the searchbar back into view) and then open it for editing. At the moment I have to scroll to the top and then tap on the scroll bar itself.

The scrolling shouldn't be to difficult but what I can't find anywhere is the code to start editing the searchbar. I tried [searchBar makeFirstResponder]; but that crashed it.

Any ideas? Many thanks.

A: 

You're looking for becomeFirstResponder.

Ole Begemann
Thanks. I'll give that a go. Sorry this is my first app so my first use of firstresponder related code.
Nik1777
No dice. For code [searchBar beginFirstResponder]; I get:*** -[UISearchBar beginFirstResponder]: unrecognized selector sent to instance 0x139570*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UISearchBar beginFirstResponder]: unrecognized selector sent to instance 0x139570'
Nik1777
@user272992: `become`, not `begin`.
KennyTM
Sorry I'm being stupid. I'll try again!
Nik1777
Beautiful! It works. How wonderfully simple. You have all been very kind.
Nik1777