I’m having some trouble implementing a design for an app I’m building. The design shows a UIActionSheet menu with a search bar at the top. When someone enters in text into the search bar, the menu goes away and is replaced by a table view containing search results. (The search results display in a similar style to when you slide all the way left on your home screen to search on your iPhone / iPod)
Here’s essentially what I’m trying to pull off:

Here’s the code I have:
// build menu
UIActionSheet* menu = [[UIActionSheet alloc] initWithTitle:@""
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Button 1",@"Button 2",@"Button 3",nil];
[menu showInView:self.view];
UISearchBar *searcher = [[UISearchBar alloc] initWithFrame: CGRectMake (0, -216, 320, 44)];
searcher.delegate = self;
// use transparent background
[[searcher.subviews objectAtIndex:0] removeFromSuperview];
[menu addSubview:searcher];
When I run this, it is as though the search bar is disabled. You cannot click on it or open up a keyboard. If I change the vertical position of the search bar from -216 to 0, I can click on it and bring up a keyboard, but I’m unable to type anything.
I’m a little confused about how I can implement this. Any ideas? I’m using Xcode 4.4 with ARC and storyboards.
That’s how
UIActionSheetobjects work. Do something else instead, like sliding up aUIView.From the Apple iOS Human Interface Guidelines: