Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From your question title, it seems you are trying to access your controller to get some data back.</p> <p>In this case, my suggestion would be creating a "model" (as in Model-View-Controller) in your design, and make that model accessible from everywhere in your app. An easy way to accomplish the latter point is to make the model class a singleton; or you might make it a class with only class-methods to give access to the data. See also <a href="https://stackoverflow.com/questions/13063984/creating-a-global-class-objective-c/13064008#13064008">this other answer of mine</a> about the same issue for some sample code.</p> <p>After reading your edit, I would suggest the following:</p> <ol> <li><p>add to your <code>contentViewController</code> class a property say it <code>dataSource</code>;</p></li> <li><p><code>dataSource</code> is of type <code>contentViewControllerDataSource</code> and provides the method to access all required data, e.g.:</p> <pre><code>@protocol contentViewControllerDataSource &lt;NSObject&gt; -(NSString*)textViewContent; @end </code></pre></li> <li><p>before adding <code>contentViewController</code> to the page controller, set its <code>dataSource</code> property:</p> <pre><code>initialViewController = [self viewControllerAtIndex:0]; initialViewController.dataSource = self; NSMutableArray *viewControllers = [NSArray arrayWithObject:initialViewController]; [pageController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil]; </code></pre></li> <li><p>let your <code>self</code> controller implement the <code>contentViewControllerDataSource</code> protocol:</p> <pre><code>@interface DonKnowTheNameOfThisOne : UIViewController &lt;contentViewControllerDataSource&gt; .... @implementation DonKnowTheNameOfThisOne; ... - (NSString*)textViewContent { return value; } </code></pre></li> <li><p>from <code>contentViewController</code> you will be able to call:</p> <pre><code>NSString* textViewContent = self.dataSource.textViewContent; </code></pre> <p>or:</p> <pre><code>self.dataSource.textViewContent = @"NEWVAL"; </code></pre></li> </ol> <p>Hope this helps.</p> <p>EDIT:</p> <p>After looking at your files:</p> <p>Please, remove the <code>#import "ViewController.h"</code> directive at the beginning of <code>contentViewController.h</code>. That should fix the problem you had.</p> <p>Another thing: I wrote at point 1 that <code>contentViewController</code> have the property <code>dataSource</code>; <code>ViewController</code> implements the <code>contentViewControllerDataSource</code> protocol and hosts the data that <code>contentViewController</code> would like to access. One class is the "client" of the data; the other "shares" the data through the delegate protocol that you can modify from outside. In your code both the <code>dataSource</code> and the protocol are assigned to the same <code>ViewController</code> class and this makes no sense. So, you can try an fix it: I am not sure now which class should be doing what, but you will know, I hope.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload