开发者

Updating the TableView inside one of the bars in UITabBarViewController when something happens inside the other bar

I have a two tabbed application. The first tab is a NavigationController that has a few TableViewControllers in it. The second tab is also a NavigationController that has a TableViewController in it.

What I'm trying to achieve is: When someone clicks on a button in the TableView inside first tab, I want to add the the clicked row to the TableView inside the second bar.

I'm already saving the information when it is clicked to NSUserDefaults. When I quit the app and restart, the second bar shows the updated info. But it doesn't show the updated rows if I switch to it while the application is running.

How can I make the second bar reload/update dynamicall开发者_如何学Pythony with the updated rows when someone does sth in the first bar?

I've called [self.navigationController parentViewController] successfully to get the tabBarViewController, which is the highest level, when the the tableview in the first bar changes. How can I get to the TableView inside the NavigatinController inside the second tab from there to have it update itself? Or should I be doing this another way?

Thanks.


i think you can call reloadData in second bar's view controller function

-(void) viewWillAppear:(BOOL)animated
{
   [tableView reloadData];
}


You could call the reloadData method on the UITableView within that TableViewController. Honestly, I think you should be using CoreData but I don't know enough of the structure of your data so... try that?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜