iphone - Change the searchDisplayController table view style to grouped? -
i have searchdisplaycontroller
searches uitableview
.
after entering search terms, can see uitableview
contains search results. however, want uitableview
grouped, not plain (like default).
how do this?
if - me - think plain tableview way ugly, can abandon use of searchdisplaycontroller.
i just:
- inserted in empty view searchbar , tableview iboutlet
- selected file's owner delegate both of them.
- at beginin number of section 0 ([mytab count]) used reloaddata , time mytab populated result.
[self.resulttableview reloaddata]
;
here can find method used delegates
@interface myviewcontroller : uiviewcontroller <uiapplicationdelegate, uisearchbardelegate> { iboutlet uisearchbar *searchbar; iboutlet uitableview *resulttableview; } @property (nonatomic, retain) iboutlet uisearchbar *searchbar; @property (nonatomic, retain) iboutlet uitableview *resulttableview; //for searchbar 2 important methods - (void)searchbarsearchbuttonclicked:(uisearchbar *)searchbarclicked; - (bool)searchbartextdidendediting; //for tableview important methods in case: //number of sections in table view. - (nsinteger)numberofsectionsintableview:(uitableview *)tableview; //headers - (nsstring *)tableview:(uitableview *)tableview titleforheaderinsection:(nsinteger)section; //different numbers of row section - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section; //the cells - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath; @end
after all, simplest solution best...
Comments
Post a Comment