tags:

views:

296

answers:

1

Hi there.

I have a UISearchBar in the table cell. All done in code (not in IB). When the search bar is activated I want to disable the table view are between the search bar and keyboard, so there is no way to touch and navigate out of this view. Cannot really get it working. Help please.

A: 

You could place a transparent UIView on top of the UITableView when the search bar is active. This would effectively disable touch events, which would now be sent to the transparent UIView and would be ignored.

As a general UI technique, if you wanted to inform the end user that the table view is no longer touchable, you could set the alpha of the UIView to 50% or the like. This would "grey out" the table view underneath.

Alex Reynolds
Hi Alex. I thought about this approach, but with a huge button instead of a view. The thing is that my search bar is not in the table header. It is in a second cell with some other view displayed in the first. The blocking view gets over the search bar in this case. I may come up with two blocking views with the proper geometry. Too bad Apple does not provide an API to make the TableView not to accept touch events.