• 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
Why does NSCollectionView want to encode items in PopUp Menu?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why does NSCollectionView want to encode items in PopUp Menu?


  • Subject: Why does NSCollectionView want to encode items in PopUp Menu?
  • From: Jerry Krinock <email@hidden>
  • Date: Wed, 16 Jun 2010 16:20:44 -0700

I've just used an NSCollectionView for the first time, following the instructions in "Quick Start for Collection Views".  The array controller's content is an array of Foo managed objects, which have a relationship to Bar managed objects.  When I got down to the subviews, I wanted a popup menu.  So I put in an NSPopUpButton and bound it thus:

PopUp Button Bindings
   Content:
      Bind to: File's Owner (Document's window controller)
      Model Key Path: document.availableBarChoices
   Content Values:
      Bind to: File's Owner (Document's window controller)
      Model Key Path: document.availableBarChoices.displayName
   Selected Object:
      Bind to: Collection View Item
      Model Key Path: representedObject.barChoice

BarChoice is a thin wrapper class around Bar, which adds capabilities of creating a new Bar from an external source.

Everything works fine, except that when the popup menu is displayed, each barChoice in the menu gets an -encodeWithCoder: message.  This occurs whether the array controller is in Entity or Class mode, and regardless of whether or not barChoice is listed as one of its keys.

At first, I did not have -encodeWithCoder: implemented, because there is no known need for it.  So I implemented -[BarChoice encodeWithCoder:] -- as a no-op -- and that satisfied it!

I've also implemented this with NSPopUpButtonCells in the column of a table view and that implementation does not have this problem.

Why might the collection view feel it needs to encode the items in this popup menu?

Jerry

_______________________________________________

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

  • Follow-Ups:
    • Re: Why does NSCollectionView want to encode items in PopUp Menu?
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: Problem using NSGradient with dataWithPDFInsideRect
  • Next by Date: Re: Why does NSCollectionView want to encode items in PopUp Menu?
  • Previous by thread: Re: Problem using NSGradient with dataWithPDFInsideRect
  • Next by thread: Re: Why does NSCollectionView want to encode items in PopUp Menu?
  • Index(es):
    • Date
    • Thread