views:

91

answers:

2

Ok, so I've asked a similar question already, but I'm now faced with a different issue on the same problem! I'm creating an iPad application and trying to replicate the Apple Mail App UI. Initially I could not update the DetailView because I was not updating the delegate when pushing a new navigation controller on the left view, this was resolved using:

newRootViewController.myDelegate = self.delegate;

I've included functionality from Apple's MultipleDetailViews code sample to include more than one detail view (using < SubstitutableDetailViewController >), but this stops the label from updating on the detail view.

I can resolve this issue by removing the connection between splitViewController and RootViewController using IB and then the label update works, although this [obviously] stops the multiple Detail view functionality from working.... any ideas?

+1  A: 

I haven't seen the MutipleDetailViews example but my guess is that its your delegate.

When you select a cell in the root it delegates to the detail. In your previous Question You where changing the root by pushing a new one onto the nav; this required you to set the delegate of the new root to the same delegate of the previous.

Your root view is pointing to your original detail.

If you replace or change the detail then any delegation sent from the root is either going to nil (if you destroyed the old detail) or you cant see it (if its just sitting behind the new detail)

If you are replacing the detail (destroyed the old one) you need to set the delegate of the root again (all/any roots).

If you are changing/adding new views then you should really be looking at NSNotificationCenter

Example:

[NSNotificationCenter defaultCenter]
  addObserver:self
     selector:@selector(handleSomethingDidHappen:)
         name:ClassCSomethingDidHappenNotification                
       object:aClassCObject];
Luke Mcneice
Thanks Luke, you've bailed me out with an answer again. Tested and all works fine using the code as per suggestion. When I can dish out rep I'll hit the up arrow!
KSoza
A: 

@KSoza

Hi I have the exact problem(I want to push a new detail view when I select a table's row in the rootcontroller) but I can't understand how to use NSNotification. Can you help me out? It would be awesome, if you could post the source code of the whole project somewhere like rapidshare or hotfile. Thanks

Stefano Salmaso
I've responded to your separate thread with an extract of my code, hope it helps - http://stackoverflow.com/questions/3892283/updating-detailviewcontroller-from-rootcontroller/3950007
KSoza