gotnull
gotnull

Reputation: 27224

iPhone/Objective-C - UISearchBar respond to touch but not display keyboard

I have a view that's used to display Comments. You can obviously comment from this view. Just like the Facebook application (checkin view) where there's a Comment bar on the bottom of the view. I would like to achieve the same functionality (not including the modal, which I've done already) when clicking on what looks like a UISearchBar.

I guess I just need to know what the best method for accepting touches are on a UISearchBar without actually having the keyboard popup (I would assume it's returning null or something on a specific delegate method perhaps?). Instead I'd like to call an action that simply presents my modal view. So I'm not actually going to allow the user to tap text into the UISearchBar, they'll do that within a UITextField on the modal.

Hope this makes sense and of course, answers are greatly appreciated.

Upvotes: 0

Views: 552

Answers (1)

Robin
Robin

Reputation: 8357

Why do you want to use UISearchBar in the first place then? I'd go for either a custom view that draws something that looks like a UISearchBar, or, even simpler, just use a UIButton with an image that looks like a UISearchBar.

In case you really wanted to use the UISearchBar I guess you could subclass it and overwrite touchesBegan:, but I don't think this a good idea.

Upvotes: 1

Related Questions