• 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
How to NSTableView and NSArrayConroller
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to NSTableView and NSArrayConroller


  • Subject: How to NSTableView and NSArrayConroller
  • From: Craig Laird <email@hidden>
  • Date: Thu, 28 Dec 2006 16:47:48 +1100



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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: How to NSTableView and NSArrayConroller
      • From: Scott Stevenson <email@hidden>
  • Prev by Date: How can I get the HDD serial number with paritition identification no like disk1s0
  • Next by Date: Re: Accessing files in QT Cache
  • Previous by thread: Re: How can I get the HDD serial number with paritition identification no like disk1s0
  • Next by thread: Re: How to NSTableView and NSArrayConroller
  • Index(es):
    • Date
    • Thread