Re: Select tablecell on creation through arrayController
Re: Select tablecell on creation through arrayController
- Subject: Re: Select tablecell on creation through arrayController
- From: Ron Lue-Sang <email@hidden>
- Date: Thu, 26 Feb 2009 09:04:12 -0800
Chances are you're calling add: on the arrayController and then
assuming that the newly added object is added to the array immediately.
I'm pretty sure the documentation says that that's an incorrect
assumption. If the value absolutely positively has to be there right
away, use addObject:. The add: method is an IBAction that does it's
work in the next run through the event loop.
No need to use a timer, just do something like
id newObject = [arrayController newObject];
[arrayController addObject:newObject];
[newObject release];
Unless you're running under GC in which case your code can be
[arrayController addObject:[arrayController newObject]];
On Feb 25, 2009, at 3:12 PM, Corbin Dunn wrote:
On Feb 25, 2009, at 2:11 PM, Walker Argendeli wrote:
I have a table with one column, that's bound to an array
controller. It calls add: on the array controller when I hit a
plus button. Problem is, I want the textFieldCell to be selected
on creation. I rewired the plus button to call a method in a
custom class. The first thing the custom class does is call the
array controller's add method. This works fine. Then, I had some
custom code based off code I used in old (non-bindings) apps. It
doesn't work though, console logs *** -[NSCFArray objectAtIndex:]:
index (1) beyond bounds (1)
Anyone understand what's going one, or have any code that would
make it work?
Anytime you have an exception raised you can generally find an easy
answer by using breakpoints.
http://www.corbinstreehouse.com/blog/index.php/2008/08/your-most-important-breakpoint-in-cocoa/
corbin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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
--------------------------
RONZILLA
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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