Pregunta

So I am really have a hard time with this. My iPad app has a side menu that contains categories, once selected loads a UIViewController that is a container. This container has a custom UITableView on the left, and a custom UIView on the right.

How can I have my container tell the UITableViewController what category was selected so it can display the proper table data. Then how can my UITableViewController tell the detail view what to display?

This is the exact same functionality of a UISplitView but my interface is completely custom designed and looks nothing like a split view, but functions like it.

Been struggling for days, any help would be greatly appreciated! Thanks a lot!

¿Fue útil?

Solución

I have found the NSNotificationCenter to be particularly helpful for sending information between different ViewControllers.

To simply explain the process, you set up a Notification Listener in the ViewController that you want to be notified, and then you post a notification in the ViewController doing the sending. Something like this to register the listener:

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

And like this to post the notification:

[[NSNotificationCenter defaultCenter] postNotificationName:@"logOutNotification" object:nil];
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top