Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you share more details we could help you, but in the meantime...</p> <p>If the master controller shows the folder and the details controller show the files, simply inject a reference of the selected folder to the detail controller.</p> <p>For example, create a property in the detail controller like this (it is needed to be synthesized)</p> <pre><code>@property (nonatomic,strong) Folders* currentFolder; </code></pre> <p>When you create a detail controller, do the following</p> <pre><code>DetailController* detCtr = // alloc-init here detCtr.currentFolder = // the folder you want to pass in </code></pre> <p><em>Some Notes</em></p> <p>Use Camel Case notation. Use <code>NSFetchedResultsController</code> for lazy loading data in association with tables, etc. Rename entity <code>Files</code> and <code>Folders</code> in their singular form.</p> <p><strong>Edit</strong></p> <p>Ok, so if you want to access your app delegate from everywhere within the app, you can just call</p> <pre><code>AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; [appDelegate someMethod]; </code></pre> <p>Here, you can retrieve the folder you are interesting in with a public property declared in .h and synthesized in .m.</p> <p>Now, this in not a so good approach to follow. AppDelegate class would remain as is.</p> <p>Another, more elegant, approach is to create a singleton called <code>SharedManager</code> (or something else) that store the <code>currentFolder</code> that need to visualize.</p> <p>Shared Manager will look like</p> <pre><code>//.h @property (nonatomic,strong) Folder* currentFolder; + (SharedManager*)sharedInstance; //.m @synthesize currentFolder; + (SharedManager*)sharedInstance { static dispatch_once_t once; static id sharedInstance; dispatch_once(&amp;once, ^{ sharedInstance = [[SharedManager alloc] init]; }); return sharedInstance; } </code></pre> <p>That, after importing it, it will be used to set a folder as the current one</p> <pre><code>[[SharedManager sharedInstance] setCurrentFolder:theFolderYouWantToShare]; </code></pre> <p>or to retrieve the current folder</p> <pre><code>Folder* theSharedFolder = [[SharedManager sharedInstance] currentFolder]; </code></pre> <p>P.S. Do not abuse on Singletons. The singleton pattern I use requires iOS 4 and greater.</p> <p><strong>Edit 2</strong></p> <p>It was my fault. I did not understand the question.</p> <p>If you need to retrieve all the files, you could just create a <code>NSFetchRequest</code> like the following:</p> <pre><code>NSEntityDescription *entityDescription = [NSEntityDescription entityForName:@"File" inManagedObjectContext:context]; NSFetchRequest *request = [[NSFetchRequest alloc] init]; [request setEntity:entityDescription]; NSError *error = nil; NSArray *results = [context executeFetchRequest:request error:&amp;error]; </code></pre> <p>where <code>results</code> will contain all the files in your store <strong>indipendently</strong> from any folder. You can use this array to display files in your table.</p> <p>If you have a lot of files, I really suggest to take a look at <code>NSFetchedResultsController</code> class. It allows lazy loading together with <code>UITableView</code>.</p> <p>You can find a good tutorial here: <a href="http://www.raywenderlich.com/999/core-data-tutorial-how-to-use-nsfetchedresultscontroller" rel="nofollow">How To Use NSFetchedResultsController</a></p> <p><strong>Edit 3</strong></p> <blockquote> <p>How to go about reminders?</p> </blockquote> <p>You should provide to your request (the one you use with <code>NSFetchedResultsController</code>) a predicate like the following</p> <pre><code>[request setPredicate:[NSPredicate predicateWithFormat:@"reminder != nil"]]; </code></pre> <p>In this manner you retrieve the files where reminder is NOT <code>nil</code>. <code>reminder</code> is the property you are using in the model.</p> <p>P.S. Check the code because I've written without Xcode support.</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.
    3. 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