I am calling two webservices and I am displaying both content in one tableview. Since I am calling asynchronously, I would like to load data whichever comes in first and call again when the second service finishes. Response from those services are inserted in their own separate sections and therefore I am saving them in their respective NSarrays.
A -> TO Web Service -> tableView reloadData whenever response arrives
B -> To Web Service -> tableView reloadData whenever response arrives
-(void)UpdateTable{
if (_firstRequest || _secondRequest){
runningRefresh = false;
[self.tableView reloadData];
[self removeLoading];
}
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if (section == 0){
return 1;
}
else if (section == 1){
if (!_firstRequest){
return 1;
}else{
NSLog(@"SECTION 1");
if ([self._collectionsNewGame isKindOfClass:[NSNull class]] || [self._collectionsNewGame count] == 0){
NSLog(@"0 COUNT");
return 0;
}
NSLog(@"%ld COUNT",[self._collectionsNewGame count]);
return [self._collectionsNewGame count] + 1;
}
}
else if (section == 2){
if (!_thirdRequest){
return 1;
}else{
if ([self._collectionsRandom isKindOfClass:[NSNull class]] || [self._collectionsRandom count] == 0){
return 0;
}
return [self._collectionsRandom count] + 1;
}
}
else return 0;
//count number of row from counting array hear cataGorry is An Array
}
I am just reading in cellrowatindexpath and displaying it.
But, when I do this, there are rows where cells are not showing up and acting weirdly. Any idea how to accomplish this?
UITableViewDataSourcemethods that provide the cells. - Dima