开发者

Newbie: how do I refresh TabView cells / trigger viewWillAppear in TabView?

I am fairly new to iPhone/ObjC programming, though I have several years of experience in coding, particularly DB development.

The project I chose as my debut is a little app meant to support playing a board game, where one is required to make notes of the playing pieces status. In short, I want to replace pen and paper with this app.

So far I have set up the main window with a TabBar (4 tabs, because of 4 players), each of which is connected to a ViewController ("FirstViewC", "SeconcViewC" etc.) which again sets up a NavController. The NavController then has a TableViewController as first subview, and when a table item is selected, a DetailViewController is added as a subview to the NavController (in didSelectRowAtIndexPath).

At this point in time, I have an object ("PlayingPiece") with some properties, which can be modified in the DetailView.

Now (eventually) here is my problem.

Coming back from the DetailView (by the OS provided "Back" button in the NavBar), the DetailView is popped from the subview stack (automatically), and the TableView is visible again. But for some reason, the changes in the PlayingPiece values are not reflected. When I scroll the cell in question out of the display, then bring it back, since there is a new cell setup invoked, everything shows up as desired.

Obviously, I need to trigger some sort of "refresh" of my displayed table cells (or all of them, we are talking about 10 table items max, so no performance issues here). I would like to call sth like [self.tableView r开发者_高级运维eloadData], but neither "viewWillAppear" nor "viewDidAppear" are called in the TableViewController.

I don't know if there is sth wrong with my whole "Controller Hierarchy" or if I am just missing out some sort of delegate that I forgot to set. I promise, I scanned several threads in forums before, but I could not find any discussion helping me further with this issue.

If there is anybody with a suggestion on that, any help is greatly appreciated - it's driving me nuts ;-) I am using the latest SDK.

Marcus


If you're using UINavigationController to push and pop the view controllers, then you may want to take a look at (UINavigationControllerDelegate):

– navigationController:willShowViewController:animated:

– navigationController:didShowViewController:animated:


I eventually figured (with some external help) that the structure of my controller setup was somewhat messed up.

After throwing out one "layer", viewWillAppear worked as expected.

Thank you for your suggestions anyway - I appreciated your support very much!

Marcus

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜