0

I know there are a lot of such questions on stackoverflow but I couldn't find the answer to mine.

I am trying to populate my UITableView from an Array that is a member of DetailViewController: UITableViewController. Problem is that I don't have values in that array at start. After I get data from web I populate the array and then I expect that the UITableViewCells get populated automatically from that update in Array. Please note that I am initializing my array in ViewDidLoad() like

self->ArrToDisplay = [[NSMutableArray alloc] init];

I read somewhere that the numberOfRowsInSection shouldn't return 0. To accomplish that I initialized my array with empty string (that I really don't want to). After that, it did call cellForRowAtIndexPath once.

So in short problem is that cellForRowAtIndexPath gets called when I initialize array with objects but I want this function to get called once I add objects to array somewhat later when they are available. I am stuck with this problem. Any help would be greatly appreciated. Thanks

shaffooo
  • 1,478
  • 23
  • 28
  • 1
    ArrToDisplay should be datasource array so when your ArrToDisplay gets filled successfully just call [self.tableView reloadData]; – Paresh Navadiya Jun 19 '12 at 04:31

1 Answers1

0

but I want this function to get called once I add objects to array somewhat later when they are available.

Once the objects are added to the array, call the reloadData of the tableview as follows.

[self.tableView reloadData];
Ilanchezhian
  • 17,426
  • 1
  • 53
  • 55