IPhone Dev: reload table view data from child controller and other controller in TabBar

I am implementing a note manager application that has a tableView in a tabBar where the main information of its notes is displayed. When accessing one note, you can edit its properties. In one tabBar button, you can choose how notes are displayed in the tableView.

The problem is that I don't know how to reload data from a child controller or from another tabBar controller. I do not know how to access tableView from them, so I can use reloadData to update TableView information from them.

I'm brand new to iPhone development ... any help would really be appreciated.

+5
source share
4 answers

You should try it NSNotificationCenter.

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(doSomething:) name:@"doSomethingNotification" object:nil];

[[NSNotificationCenter defaultCenter] postNotificationName:@"doSomethingNotification" object:nil];
+8
source

Put the table update code in viewWillAppear: instead of viewDidLoad - this way, every time you return to the parent controller from the child controller, the data gets reloaded.

+4
source

MVC ,

, . , .

reload data, .

[tableviewController.tableview reloadData]; 

, .

+2

. , , .

, - XCode. , XCode, .

, , tableviewcell . .

, - , iOS 5. , .

In any case, the storyboard is great, and I’ll try to get used to it, it paints the big picture of your application and easily handles the relationship between the different views. Plus, I really like his prepareforsegue method.

OK, good luck.

0
source

All Articles