I have built a view based application which currently has a single view and a single window. When the app is launched, the view is displayed instantly. On the view I have a UISearchBar and UITableView both added using Interface Builder.
When the app is launched, the UITableView calls the delegate methods I have created to get the initial data, which is nothing. I have defined:
which returns 1 when first called (no data...returning 0 generates an exception)
which returns 0 when first called (no data)
which sets the cell text to be blank
When the search button is pressed, another method is called which runs through and populates an array with data. After completing
is called which should cause the 3 functions above to be executed again, therefore getting the new data which has been populated into the array.
I have verified using NSLog that those 3 functions are called at the beginning of the app launch and when the search button is pressed, the data is populated into the array.
However, when reloadData is called, the 3 functions are not called. They are only called when, in the simulator, the table is scrolled back and forth e.g. row 0 updates after it has disappeared and reappeared.
I need the whole table to update immediately where I'm calling reloadData. Any idea why this isn't happening?
When the app is launched, the UITableView calls the delegate methods I have created to get the initial data, which is nothing. I have defined:
Code:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
Code:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
Code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
When the search button is pressed, another method is called which runs through and populates an array with data. After completing
Code:
[tableView reloadData];
is called which should cause the 3 functions above to be executed again, therefore getting the new data which has been populated into the array.
I have verified using NSLog that those 3 functions are called at the beginning of the app launch and when the search button is pressed, the data is populated into the array.
However, when reloadData is called, the 3 functions are not called. They are only called when, in the simulator, the table is scrolled back and forth e.g. row 0 updates after it has disappeared and reappeared.
I need the whole table to update immediately where I'm calling reloadData. Any idea why this isn't happening?