How to make UITableView refresh in tabbed interface
I am deve开发者_运维知识库loping a medical application with a three-tab interface. The first two tabs bring up two UITableViews, one with calculations in alphabetical order, and one with calculations in categories. Both of these tabs allow the user to enter numerical data. The third tab displays all entered and calculated data so far. The table views for the first two tabs derive from two plists. The data for the third tab derives from a NSmutablearray generated from entered and calculated data.
My issue is that the third tab for data display shows data results properly only the first time the tab is used. If the user goes back to the first two tabs and makes additional data entries and calculations, then the table view in the third tab does not refresh. Is there a spot in the view controller code for this third tab where I can force a refresh?
I have tried: [self.tableView reloadData]; but placing this code in the view controller after - (void)viewDidAppear:(BOOL)animated does not work.
Thanks in advance.
As long as self.tableView
is not nil reloadData
will work. It sounds like your NSMutableArray
on the third tab is not getting updated once it is loaded. However you updated it the first time is what needs to happen. If you were updating it in -(void)viewDidLoad
try moving it to -(void)viewDidAppear:(BOOL)animated
精彩评论