Refresh other UITableView and viewuitableview from a subview or View
I was asked a question: how to refresh other uitableviews from a subview or a View. The general syntax may be as follows:
TestTVC*testTVC =[[TestTVC alloc] init];
[testTVC loadData];
At this time, you can see that UITableView will not be refreshed. At least cellForRowAtIndexPath will not run. Why? Because the init of TestTVC is actually re-init A TestTVC, and loadData does not work for the existing TestTVC. However, if the loadData method contains API data, this operation is successful. However, tableview is not re-rendered.
The two most common answers on the Internet are:
1. '[self. tableView reloadRowsAtIndexPaths: [self. tableView indexPathsForVisibleRows] withRowAnimation: UITableViewRowAnimationNone]; 'This is also not acceptable. any operation involving refresh view will not succeed, although it is better than self. tableView reloaddata is better than 'cellforrowatindexpath', but the data cannot be refreshed.
2. The main thread calls, '[testTVC unzip mselecw.mainthread: @ selector (loadData) withObject: nil waitUntilDone: NO];' still only updates data and does not refresh the view
Solution: use notification:
[[NSNotificationCenter defaultCenter] postNotificationName:RELOAD_DATA object:self];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(loadData) name:RELOAD_DATA object:nil];
-EOF-