Skip navigation.
 
mlRe: cocoa bindings NSTableColumn to @allKeys?
FROM : Michael Hanna
DATE : Tue Jan 01 19:19:32 2008

I think I got it, thanks ..

I want to retain Tiger compatibility(at least for now) so I changed my
model slightly. I created a YKKFlickrPhoto class. A YKKFlickrPhotoList
has an NSArray of these.

I load in all the photos into the photolist. I send
[m_photosController setObjectClass[YKKFlickrPhoto class]]; //
(m_photosController is an NSArrayController)
[m_photosController setContent:photos];

but [m_photosController content] returns null
I am certain photos is not null.
Also tried:     [m_photosController bind:@"contentArray" toObject:photos
withKeyPath:@"" options:nil];

here is my observing method:

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object
change:(NSDictionary *)change context:(void *)context
{
   if (context == SelectedObjectsContext)
   {
       if ([[object selectedObjects] count] > 0)
       {
           if ([[object selectedObjects] objectAtIndex:0] != nil)
           {                
               // get the photolists for the current user, find the photolist
that matches the selection
               NSMutableDictionary *currentPhotoLists = [[self currentUser] photoLists];
               
               YKKFlickrPhotoList *currentPhotoList = [currentPhotoLists
objectForKey:[[object selectedObjects] objectAtIndex:0]];
               NSArray *photos = [currentPhotoList photos];
               NSLog(@"photos %@", photos);
               
               [m_photosController setObjectClass:[YKKFlickrPhoto class]];
               [m_photosController setContent:photos];
               //[m_photosController bind:@"contentArray" toObject:photos
withKeyPath:@"" options:nil];
               NSLog(@"[m_photosController content] %@", [m_photosController content]);
           }
       }
   }
   else
   {
       [super observeValueForKeyPath:keyPath ofObject:object change:change
context:context];
   }
}

I want to bind the photos to a controller so that I can display their
contents .. suggestions?

Michael

On Dec 31, 2007 1:41 AM, mmalc crawford <<email_removed>> wrote:
>
> On Dec 30, 2007, at 11:08 PM, Michael Hanna wrote:
>
> > I want to make another tableview with a column that displays the photo
> > attributes of the selected photolist. Do I bind to the Flickr Photo
> > List NSArrayController? This is only displaying the photolist key
> > names ... how do I get at the values that that key represents? Do I
> > have to use an NSDictionaryController to do this?
> >
> It would certainly be easier if you used a dictionary controller
> (which you would use in place of the Flickr Photo
> List array controller).
> You can look at <http://developer.apple.com/samplecode/DictionaryController/index.html

>  > to see how they're configured.
>
> If you have to target Tiger, then you can in (likely in your own
> custom class, or a subclass of an array controller) observe the Flickr
> Photo List's selection (e.g. selectedObjects) and as that changes get
> the values for the selected key from the selection in the original
> array controller and set the values as the content for the values
> array controller.
> I hope that makes sense?
>
> mmalc
>
>

Related mailsAuthorDate
mlcocoa bindings NSTableColumn to @allKeys? Michael Hanna Dec 30, 08:00
mlRe: cocoa bindings NSTableColumn to @allKeys? Keary Suska Dec 30, 18:16
mlRe: cocoa bindings NSTableColumn to @allKeys? mmalc crawford Dec 30, 19:53
mlRe: cocoa bindings NSTableColumn to @allKeys? mmalc crawford Dec 30, 20:13
mlRe: cocoa bindings NSTableColumn to @allKeys? Michael Hanna Dec 31, 03:12
mlRe: cocoa bindings NSTableColumn to @allKeys? Michael Hanna Dec 31, 07:19
mlRe: cocoa bindings NSTableColumn to @allKeys? Michael Hanna Dec 31, 08:08
mlRe: cocoa bindings NSTableColumn to @allKeys? mmalc crawford Dec 31, 08:10
mlRe: cocoa bindings NSTableColumn to @allKeys? mmalc crawford Dec 31, 10:41
mlRe: cocoa bindings NSTableColumn to @allKeys? Michael Hanna Jan 1, 19:19
mlRe: cocoa bindings NSTableColumn to @allKeys? mmalc crawford Jan 1, 20:33