When using UITableView, If you modify some UITableViewCell-related content in UITableView in another view, you need to re-load the modified data when calling popViewController to return the UITableView, UITableViewCell data is not reloaded by default.
In general, we can solve this problem by adding [self. tableView reloadData] To the viewWillAppear function in the UITableViewController. m file. This function will call the cellForRowAtIndexPath method to reload the data of UITableViewCell.
However, we sometimes find that the content of UITableViewCell cannot be refreshed even if reloadData is called. At this time, it is very likely that the order of the popViewController you call is incorrect, that is, the function of popViewController is called too early, because after the function of popViewController is called, the compiler will start from self. in the navigationController stack, obtain the top-level ViewController (UITableViewController) and display its view. This process calls functions on these initial display interfaces, such as the ViewWillAppear function, if you modify some attributes in UITableView only after popViewController, although the value of the attributes can be changed, the UITableView is displayed, therefore, the new property values cannot be displayed on the interface, resulting in the illusion that the content is not refreshed.
Solution:
Call the popViewController method after modifying the attribute value. See the following code (1 ). In addition, to obtain the UITableViewController, because the current ViewController has not been pop up yet, you need to take the next Controller at the top of the stack, see (2 ).
NSArray * allControllers = self. navigationController. viewControllers;
RenewTableViewController * parent = [allControllers objectAtIndex: [allControllers count]-2]; // (2)
Parent. test = @ "test ";
[Self. navigationController popViewControllerAnimated: YES]; // (1)