Hi,
I have a webservice which returns a value. Depending on the value i want to create a new tableview with that many rows.
For example if the webservice returns a value 5. In that case i want to display a new tableview with 5 rows.
My problem is, how do i wait till the webservice executes and return a value.
Since the code does not wait the rowcount value is 0.
Any suggestions on what i should do??
thanks
Code:
(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *selectedVertical =[listOfItems objectAtIndex:indexPath.row];
[self connectToWebservice: selectedVertical];
if (RowCount > 0)
{
//Get the dictionary of the selected data source.
NSDictionary *dictionary = [self.tableDataSource objectAtIndex:indexPath.row];
//Get the children of the present item.
NSArray *Children = [dictionary objectForKey:@"Children"];
//if([Children count] == 0) {
DetailViewController *dvController = [[DetailViewController alloc] initWithNibName:@"DetailView" bundle:[NSBundle mainBundle]];
[self.navigationController pushViewController:dvController animated:YES];
[dvController release];
RowCount=-1;
}
}