• 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: NSPopupButton with NSArrayController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSPopupButton with NSArrayController


  • Subject: Re: NSPopupButton with NSArrayController
  • From: Ferhat Ayaz <email@hidden>
  • Date: Sun, 7 Jan 2007 03:49:48 +0100

ok. I got it. addObject: was the keyword. Thanks a lot.


- (IBAction)makeInvoice:(id)sender
{
NSManagedObjectContext *moc = [invoiceArrayController managedObjectContext];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Invoice" inManagedObjectContext:moc];
NSString *className = [entity managedObjectClassName];
Class entityClass = NSClassFromString(className);
NSManagedObject *invoice = [[entityClass alloc]
initWithEntity:entity
insertIntoManagedObjectContext:moc];
[invoiceArrayController addObject:invoice];
NSLog(@"Invoice nr: %@",[invoice valueForKey:@"nr"]);
}



On Jan 7, 2007, at 2:42 AM, Andreas Mayer wrote:


Am 07.01.2007 um 01:04 Uhr schrieb Ferhat Ayaz:

I want to use the add: method of an NSArrayController.

Why?

This is very important.

Why?

Any AppKit tasks (refreshing TableViews etc.) are performed "after" method -makeInvoice.

That's why you should create the object yourself and use - addObject: instead of -add:


Anyway. *Assuming* -selectsInsertedObjects ist set to YES for your controller, -selectedObjects will return an array containing your newly created object after adding it. But I'm not sure if this works before the next run through the run loop or only afterwards. Again: To avoid this problem, just create the object yourself.


Andreas _______________________________________________

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:
40googlemail.com


This email sent to email@hidden

_______________________________________________

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: NSPopupButton with NSArrayController
      • From: "I. Savant" <email@hidden>
References: 
 >NSPopupButton with NSArrayController (From: Ferhat Ayaz <email@hidden>)
 >Re: NSPopupButton with NSArrayController (From: "I. Savant" <email@hidden>)
 >Re: NSPopupButton with NSArrayController (From: Ferhat Ayaz <email@hidden>)
 >Re: NSPopupButton with NSArrayController (From: "I. Savant" <email@hidden>)
 >Re: NSPopupButton with NSArrayController (From: Ferhat Ayaz <email@hidden>)
 >Re: NSPopupButton with NSArrayController (From: "I. Savant" <email@hidden>)
 >Re: NSPopupButton with NSArrayController (From: Ferhat Ayaz <email@hidden>)
 >Re: NSPopupButton with NSArrayController (From: "I. Savant" <email@hidden>)
 >Re: NSPopupButton with NSArrayController (From: Ferhat Ayaz <email@hidden>)
 >Re: NSPopupButton with NSArrayController (From: "I. Savant" <email@hidden>)
 >Re: NSPopupButton with NSArrayController (From: Ferhat Ayaz <email@hidden>)
 >Re: NSPopupButton with NSArrayController (From: Andreas Mayer <email@hidden>)

  • Prev by Date: Re: Making a new app - Need Implementation Advice.
  • Next by Date: Re: NSPopupButton with NSArrayController
  • Previous by thread: Re: NSPopupButton with NSArrayController
  • Next by thread: Re: NSPopupButton with NSArrayController
  • Index(es):
    • Date
    • Thread