I have a root view controller, which presents the modal view controller with standard animation (modal view controller appears from bottom to top).
Let's name this view controllers MyRootViewController and MyModalTableViewController.
The problem is animation stops if MyModalTableViewController reloads data when it appears.
For example:
- (void)openModalViewController {
MyModalTableViewController * vc = [self.storyboard instantiateViewControllerWithIdentifier:@"myModalScreen"];
[self presentViewController:vc animated:YES];
}
And in MyModalTableViewController I have the next code:
- (void)viewDidLoad {
self.itemList = [[MyData sharedInstance] itemList]; // self.itemList is NSArray
}
// ...
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
MyTableViewCell * cell = [tableView dequeReusableCellWithIdentifier:@"myCell"];
cell.item = self.itemList[indexPath.row];
return cell;
}
So when MyModalTableViewController is loading from storyboard, it loads itemList and shows it on UITableView. And presentation animation starts only when UITableView complete to load data. I guess it because the animation and data reloading works in the same thread. So if I have 10000 items to show, it takes few seconds and only then presentation animation starts.
It is too slow. So my question is what is the best way to solve this problem?