I have a structure like this….
UITableViewController -> UITableViewCell -> UIView
I need the UIView to access a HashTable (NSMutableDictionary) in the UITableViewController
Is there a way to access the ViewController simply from the ViewCell (using [ViewCell superview] obviously won’t work) ….Do I need to go down through the AppDelegate using [[UIApplication sharedApplication] delegate]?
Thanks!
I usually maintain a weak reference from my UIView to my UIViewController if I need one, usually by creating a method something like this:
You could also use a delegate pattern if you want a more decoupled solution. I tend to think this is overkill for a view and its controller, but I would use it with a system of controllers and subcontrollers.