I'm modifying my UITableView's data source from a PHChange instance, and this works fine. What I don't understand is I can't get the sectionIndex on the right of the UITableView to update unless you reload the whole UITableView with: reloadData.
Is there any other way to force update the sectionIndex on the right of the UITableView? If I manually call: sectionIndexTitlesForTableView: I confirm that I'm getting back fresh data, however the old sectionIndex on the right doesn't change visually, which is what I need.
Code:
PHFetchResultChangeDetails *changeDetails = [changeInstance changeDetailsForFetchResult:oldFetch];
if (changeDetails)
{
PHFetchResult *fetchResultAfterChange = changeDetails.fetchResultAfterChanges;
if (fetchResultAfterChange.count < 1)
{
[subArray removeObjectAtIndex:subIdx];
dispatch_async(dispatch_get_main_queue(),^
{
NSIndexPath *path = [NSIndexPath indexPathForRow:subIdx inSection:idx];
[self.albumsTableView deleteRowsAtIndexPaths:@[path] withRowAnimation:UITableViewRowAnimationNone];
// Confirmed data is updating
NSLog(@"%@",[self sectionIndexTitlesForTableView:self.albumsTableView]);
// Does nothing
[self.albumsTableView setNeedsDisplay];
});
}
}
Try this function
- reloadSectionIndexTitles