Reputation: 6451
I have 2 uitableview settings and searchResult as following
IBOutlet UITableView* Settings ;
IBOutlet UITableView* SearchResult;
@property ( nonatomic , retain ) IBOutlet UITableView* Settings ;
@property ( nonatomic , retain ) IBOutlet UITableView* SearchResult;
to diffrentiate between them in the tableview delegate and source I search by the table name
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
if (tableView == Settings ) {
return 2;
} else {
return 0 ;
}
}
the second table never fire the events , I mean the settings table work very well , but the second never fire the events even I set its datasource, and delegeate to file owner
also [self.SearchResult reloadData];
never fire the events
any suggestion to solve that
Best regards
Upvotes: 0
Views: 379
Reputation: 309
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
NSInteger *returnValue = 0;
if ([tableView isEqual:Settings]{
NSLog (@"Settings did called datasource methods");
returnValue = 2; // number of sections in your table - if you have NSArray datasource use [datasource count] ;
} else if ([tableView isEqual:SearchResult"){
NSLog (@"SearchTable did called datasource methods);
returnValue = 1; // or count of that datasource
}
return returnValue;
}
This might help to debug
Upvotes: 0
Reputation: 26400
Shouldn't the number of sections in the second table be 1 instead of 0? The second table will not be visible if the number of sections is 0..
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
if(tableView == Settings )
{
return 2;
}
return 1; // Called for second table
}
Upvotes: 1
Reputation: 6954
Have you manually set the delegate and datasource for both the tables??? If not set it... This might help
Upvotes: 1