• 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: Cocoa Bindings and popups
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa Bindings and popups


  • Subject: Re: Cocoa Bindings and popups
  • From: Chuck Musser <email@hidden>
  • Date: Sun, 18 Jul 2004 22:23:06 -0700

I implemented these six methods, to no avail:

- (NSMutableArray *)rideDescriptionList;
- (void)setrideDescriptionList:(NSMutableArray *)newList;
- (unsigned)countOfrideDescriptionList;
- (id)objectInrideDescriptionListAtIndex:(unsigned)index;
- (void)insertObject:(id)theObject inrideDescriptionListAtIndex:(unsigned)index;
- (void)removeObjectFromrideDescriptionListAtIndex:(unsigned)index;

Before I implemented them, adding an item to the array never printed any messages out on the console when I debugged it. You'd think that it would get a "no selector found" or something when I added new items to my array. Now that the methods *are* implemented, the application still behaves the same way. The only thing I can conclude is that I didn't affect the area that's broken. It's like the all the connections aren't in place, so these methods aren't even being invoked.

I am a hazy on several things:

1.) The values to fill in the Bindings area. In the RideList object (this is the NSArrayController), the contentArray binding looks like this

Bind to: PostAlias (this is the NSObjectController)
Controller Key: selection (what does this mean?! I don't understand the meaning of "selection" in this context.)
Model Key Path: rideDescriptionList (this is the instance variable in my main controller object PostController), which is the "real" controller object that the PostAlias "content" outlet points to.

Does this look right?

2.) In the Attributes inspector for my NSArrayController, there are two keys: label and rideDescriptionList. What are these keys? I don't remember putting them in this list directly.

3.) In the Attributes inspector for my NSObjectController, the Object Class Name is NSMutableArray; in my NSArrayController, it's RideDescription. Given that my list is an NSMutableArray of RideDescription objects, are these settings appropriate.

4.) I copied the ArrayController --> PostAlias --> PostController arrangement from an example program because it was convenient AND because I couldn't bind the array controller directly to the PostController (it didn't show up in the Bind To: list, probably because PostController isn't an NSObjectController or a subclass thereof). I did try to subclass NSObjectController and use that subclass as my main controller object, but Interface Builder didn't let me instantiate it! The "Instantiate" menu item was grayed out.

I guess my point is that my architecture might just be wrong. Have I structured this the right way or do I need to architect this a different way?

Thanks,

Chuck


It could be that you need to make your accessor methods for rideDescriptionList Key-Value Coding compliant.

http://developer.apple.com/documentation/Cocoa/Conceptual/ KeyValueCoding/Concepts/Compliant.html

This would mean that in your content objects for PostAlias you have methods like this:

- (unsigned)countOfRideDescriptionList
{
return [rideDescriptionList count];
}

- (id)objectInRideDescriptionListAtIndex:(unsigned)index
{
return [rideDescriptionList objectAtIndex:index];
}

and likewise - (void)insertObject:(id)theObject inRideDescriptionListAtIndex:(unsigned)index and (void)removeObjectFromRideDescriptionListAtIndex:(unsigned)index

Although it says you can just return a mutable array, I've found if you have other controllers observing the array they work by observing these methods.

Hope that helps,

Steve
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Cocoa Bindings and popups
      • From: Steve Harris <email@hidden>
    • Re: Cocoa Bindings and popups
      • From: Scott Anguish <email@hidden>
References: 
 >Re: Cocoa Bindings and popups (From: Steve Harris <email@hidden>)

  • Prev by Date: Re: cocoa app from scratch
  • Next by Date: Re: Cocoa Bindings and popups
  • Previous by thread: Re: Cocoa Bindings and popups
  • Next by thread: Re: Cocoa Bindings and popups
  • Index(es):
    • Date
    • Thread