views:

78

answers:

2

Hey guys, I have a searchDisplayController that searches a UITableView that I have. After entering the search terms, I can see another UITableView that contains the search results. However, I want this UITableView to be GROUPED, not PLAIN (like it is by default).

Would anyone know how to do this?

Thanks alot!!

+1  A: 

This is not possible as the searchResultsTableView property is readonly.

Jacob Relkin
so basically there is absolutely no way to change it to a grouped style? that's absurd that apple would refrain us from doing such a thing..
David
@David, I know it sucks. :(
Jacob Relkin
A: 

You could try to create a subclass of UISearchDisplayController and make searchResultsTableView searchable

in any .h file add:

@interface YourUISearchDisplayController : UISearchDisplayController {
   UITableView * searchResultsTableView;
}

@property (nonatomic) UITableView * searchResultsTableView;

@end;

Then just use YourUISearchDisplayController instead od UISearchDisplayController.

Note: you might have to use (nonatomic, retain), (nonatomic, assign), or (nonatomic, copy). I'm not really sure

Jason Jensen
"Then just use YourUISearchDisplayController instead of UISearchDisplayController."So this is what I did:myUISearchDisplayController = [[MyUISearchDisplayController alloc] initWithStyle:UITableViewStyleGrouped]; self.searchDisplayController.searchResultsTableView = myUISearchDisplayController.searchResultsTableView;But it gives me the error that "/RootViewController.m:472: error: object cannot be set - either readonly property or no setter found"Is there a work-around?
David
@David, I don't think it's possible to override properties in Objective-C, it's only possible to override **methods**.
Jacob Relkin
Yeah it looks like you're out of luck. Turns out even if you write setters for read-only properties they just keep calling themselves.
Jason Jensen
As an afterthought: you can ask apple to change it, though I don't know what the odds are there.
Jason Jensen