Search code examples
iphonescrollreloadtableview

uitableview reload problem


i have a tableviewcontroller and inside it i am trying loading data of the table. i have an array and creating my custom table cells using this array. it works fine at first time but when i want to refresh table data (after updating array i call reloadData method of tableview) but updated data appears after scrolling. and also new array size is shorter than the first one it throws exception when scrolling toward bottoms.

reloadData does not work properly

myArray = [self getNewData:0];  //updating array which is used to creating cells
[self.tableView reloadData];    //reload data

thanks...


Solution

  • It sounds like the call to reloadData is being completely uneffective. So check that self.tableView is non-nil at the point you're calling it -- put an NSLog above that line like so:

    NSLog(@" self.tableView = %@", self.tableView);
    

    If it's nil, that's your problem.