views:

666

answers:

1

I am working on an iPhone application that has a UISearchBar which populates a table view. I have various options on my search that could be easily hooked into the 'scope' functionality. However, I really need to have two groups of buttons. One group would be 'scope' determining the type of search, and one group that indicates the sort order of the results returned. As far as I can tell, you can only have one 'scope' item selected at once, using the normal functionality.

I only load a small portion of the possibly results with each query (for speed), so I can't sort using the table view alone. It needs to be passed to my search query each time, thus I need the user to be able to choose both a search type and a search order.

Right now, I just have two different UISegmentedControl's below my UISearchBar, and I do everything by hand. This works. However, even if I make the background grayish, it doesn't have the look of being part of the search bar (like the scope on the mail.app).

Any ideas? I am fairly new at the SDK, so it is very possible I missed something. I only found out about the scope functionality after I had already coded the segmented controls by hand!

+1  A: 

I'm not sure if this will help but you can access the segmented control that is used with the search bar with the code below. Maybe you can tweak or replace it with something?

// Find scope segmented control
for (UIView *v in searchBar.subviews) {
    if ([v isMemberOfClass:[UISegmentedControl class]]) {   

        // You've got the segmented control!     
        UISegmentedControl *scope = (UISegmentedControl *)v;

        // Do your thing here...

    }
}
Michael Waterfall