objective c - How to search in UITableview which have multi section in iOS -
my uitableview
have 2 section "local currency" , "all currencies".
no problem when search , both section return results. when search , return results within section 2 no cell in section "all currencies" displayed. 's display header of "local currency" 0 cell.
i want when search if section no have in result header of session hidden , secion have result display header , content.
this code , searchresultslocal,searchresultspopular
2 results nsarray
when search:
-(nsinteger)numberofsectionsintableview:(uitableview *)tableview { //if (searchresultslocal.count > 0 && searchresultspopular.count > 0) { // return 2; //} return 2; } -(nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { if (section==0) { return [searchresultslocal count]; } return searchresultspopular.count; }
ay appreciable. in advance.
tks u much.i have figure out solution :
- (cgfloat)tableview:(uitableview *)tableview heightforheaderinsection:(nsinteger)section { if ([tableview.datasource tableview:tableview numberofrowsinsection:section] == 0) { return 0; } return 20; }
Comments
Post a Comment