• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSOutlineView loading of data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSOutlineView loading of data


  • Subject: NSOutlineView loading of data
  • From: Brandon Meyer <email@hidden>
  • Date: Mon, 3 Oct 2005 17:56:13 -0500

I have an NSOutlineView that I am trying to load data into. I can create 'nodes', edit the name, and then save the contents of the OutlineView into a file. However, I cannot seem to properly load the data back into the OutlineView.
One thing that I've noticed, if I create a new 'node' and click on it, it loads the data into the TableView that is associated with the first 'node' I created and then saved.
The OutlineView has its delegate and dataSource set to the appropriate controller.


Here are my loading/saving methods:
// ======================================================================== =====
// Saving of data
//---------------------------------------------------------------------- -------
- (void) saveDataToDisk
{
NSString * path = [self pathForDataFile];


  NSMutableDictionary * rootObject;
  rootObject = [NSMutableDictionary dictionary];

  [rootObject setValue: [self categories] forKey:@"categories"];
  [NSKeyedArchiver archiveRootObject: rootObject toFile: path];
}


// ======================================================================== =====
// Loading of data
//---------------------------------------------------------------------- -------
- (void) loadDataFromDisk
{
NSString * path = [self pathForDataFile];
NSDictionary * rootObject;


    rootObject = [NSKeyedUnarchiver unarchiveObjectWithFile:path];
    [self setCategories: [rootObject valueForKey:@"categories"]];
}


- (NSMutableArray *) categories { return _categories; }

- (void) setCategories: (NSArray *)newCategories
{
if (_categories != newCategories)
{
[_categories autorelease];
_categories = [[NSMutableArray alloc] initWithArray: newCategories];
}
}


Thanks in advance for any advice!
Brandon

P.S. I can provide any other required information needed. Just ask!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: NSOutlineView loading of data
      • From: Stephane Sudre <email@hidden>
  • Prev by Date: NSTextView - printing page numbers and headers
  • Next by Date: Re: Setting the source of an NSArrayController from more than one other controller
  • Previous by thread: Re: NSTextView - printing page numbers and headers
  • Next by thread: Re: NSOutlineView loading of data
  • Index(es):
    • Date
    • Thread