0

I have UIview contains tableview with search display controller

after searching it display the same table my expectation I have a problem with :

TableView numberOfRowsInSection# so I debugged it. it display search view but it doesn't fire the if statement

- (NSInteger)tableView:(UITableView *)theTableView numberOfRowsInSection:(NSInteger)section
{
    if (tableView == aSearchDisplayController.searchResultsTableView)
        {
            return [self.searchResults count];
        }
        else
        {
            return [collection count];
        }
}
Community
  • 1
  • 1
Mohammed
  • 334
  • 1
  • 5
  • 22
  • well are you sure that the search dislay controller has connected the table with files owner and your search bar is connected to the controller and delegate connected to files owner and all necessary connections are made? Also, are you even sure taht numberOfRowsInSection is even being called? – MCKapur Nov 08 '12 at 09:51
  • search display controller all its connection give me Fileowner except search bar – Mohammed Nov 08 '12 at 10:20
  • search bar should be connected to search dislay cnotroller – MCKapur Nov 08 '12 at 10:38
  • Strange, is numberOfRowsInSection getting called? put an nslog at the beginning of the method – MCKapur Nov 08 '12 at 11:16
  • CAn you insert an nslog in that else statement and see it is being called – MCKapur Nov 08 '12 at 11:58

1 Answers1

0

The first parameter in your delegate function is called theTableView and not tableView, so you should compare

if (theTableView == aSearchDisplayController.searchResultsTableView)
    ...
Martin R
  • 529,903
  • 94
  • 1,240
  • 1,382