Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to NSTableView and NSArrayConroller





Hi All
I am hoping that someone can help me with this, as a newbie to Cocoa please be nice :)
I have worked though some Tutorials on using NSArrayConroller but they only talk and show how to add and remove
from a NSTableView.


Ok I am playing with the address-Book framework and I have created an NSMutableArray called contact
that i want to show in a NSTableView


	This is the MyController.h file


#import <Cocoa/Cocoa.h> #import <AddressBook/AddressBook.h>

@interface MyController : NSObject
{
    NSMutableArray *contact;
}
@end


This is the MyController.m file #import "MyController.h"

@implementation MyController
- (void)awakeFromNib
{

    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

    ABAddressBook *book = [ABAddressBook sharedAddressBook];
	contact = [book people];
	NSLog( [contact description] );

    [pool release];
    return 0;
}
@end


In the Interface builder I added a NSObjectController and named it ControllerAlias and hooked it to
MyController
Then added a NSArrayConroller called Contacts, under bindings
contentArray bind to is set to ControllerAlias
Model Key Path is set to contact
Then I used the bindings to set the value of the column
bind to is set to Contacts(NSArrayController)
Controller Key is set to arrangedObjects
Model Key Path is set to name

So what else do I need to do ??


My objective is to list all the contacts in the Address Book and then sort the alphabetically


Cheers

	Craig


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.