0

I have an iPad application with a UISplitView implemented. Within the UISplitView, I have some data being stored. A simple ID. I need to obtain this ID in the child view controllers of this UISplitView and I cannot figure out how to do it.

Here is what I have in my splitView.h file

 @interface SplitView : UISplitViewController{
     int reportId;
 }

 @property(nonatomic, assign) int reportId;

This is how I was attempting to obtain the data from the detail view. I have my main view inside a navigation view controller first, then inside the splitview, so I am calling like:

 SplitView *mainVC = (SplitView *)[[self presentingViewController] presentingViewController];
 NSLog(@"Getting report ID: %i", [mainVC reportId]);

** This code doesn't work. It makes sense to me... But obviously I am doing something wrong. Any help is apprecaited.

rckehoe
  • 1,198
  • 15
  • 16
  • Shouldn't you be casting to ChemicalReportSplitView not to SplitView? Not sure if you did that on purpose or not.. – Joel Bell Mar 04 '14 at 21:27
  • I am, but to make the code easier to read I changed it, and forgot to change the one. Sorry, any recommendations? – rckehoe Mar 05 '14 at 01:52
  • possible duplicate of [How can I passing data from parent view controller to child view controller?](http://stackoverflow.com/questions/22238565/how-can-i-passing-data-from-parent-view-controller-to-child-view-controller) – Logan Mar 13 '14 at 22:17

0 Answers0