• 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
Re: NSCollectionView and CoreData question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSCollectionView and CoreData question


  • Subject: Re: NSCollectionView and CoreData question
  • From: Matthew Delves <email@hidden>
  • Date: Wed, 23 Apr 2008 18:59:15 +1000


On 23/04/2008, at 12:08 AM, I. Savant wrote:

Having set the 'content' binding to the arrangedObjects key in IB didn't
produce a result though doing it programmatically has. Not sure why this
would be.

It depends. Since you have provided neither the exact bindings settings you're using nor the code you used to establish the binding manually, it's impossible to say.

Further, with the NSView, is there a way of knowing which of the objects
that are contained in the NSCollectionView is being drawn and further being
able to get the data for that specific object?

Not to sound like a broken record, but, have you *read* the documentation? Sure, the NSCollectionView / NSCollectionViewItem mechanism is a bit more challenging than your standard button or table, but not by much and it is fairly well-documented. See NSCollectionViewItem's documentation, paying particular attention to the phrase "represented object".

What I've been using as far as trying to get the represented object is first having the following as part of awakeFromNib in my controller object.


[theView setDelegate:self];
[collectionView bind:@"content"
toObject:self
withKeyPath:@"arrangedObjects"
options:nil];
[collectionView setItemPrototype:collectionViewItem];
repObject = [[NSManagedObject alloc] initWithEntity: [NSEntityDescription entityForName:@"PodcastEpisodeTimestamp"
inManagedObjectContext:[selfmanagedObjectContext]]
insertIntoManagedObjectContext:[self managedObjectContext]];


	[collectionViewItem setRepresentedObject:repObject];


Though when I try to do something with what is returned by the represented object such as


[[collectionViewItem representedObject] valueForKey:@"length"]

This unfortunately returns nil.

Is anyone aware of what I'm doing wrong with this?

Thanks,
Matthew Delves
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Uneditable NSTableView
  • Next by Date: Re: Uneditable NSTableView
  • Previous by thread: Re: NSCollectionView and CoreData question
  • Next by thread: Programmatically placing an item in the dock
  • Index(es):
    • Date
    • Thread