On Feb 2, 2009, at 11:19 AM, Chris Anderson wrote:

Ok, upon further investigation it would seem that the objects are initializing in an order I don't understand. I verified this by overriding the mouseDown method and getting the same results. I also tried invoking awakeFromNib but that too did not work. I tried a performSelector:withObject:afterDelay within the awakeFromNib and called a separate method to get the array controller to respond. awakeFromNib was invoked twice on application start...the first time the array controller responds successfully. The second time, where the datepicker control in the nib is actually loaded, it does not respond.

- (void)awakeFromNib
{
        [self performSelector: @selector(prepareOutlets)
                           withObject: nil
                           afterDelay: 1.0];
}

-(void)prepareOutlets
{
NSLog(@"array count: %i", [[myArrayController arrangedObjects] count]);
}

Log...

2009-02-02 11:04:05.375 [myapp] array count: 1 (I think this is the object of the subclass I've created in IB) 2009-02-02 11:04:05.385 [mhapp] array count: 0 (NSDatePicker control is calling this one..verified)


I must be missing something fundamental but I have no idea what. Thanks,

As Keary said, the first thing I would do is validate if myArrayController, or the result from [myArrayController arrangedObjects] is nil or not. This should be trivial to do by placing a breakpoint on the said method and inspecting the variable when the breakpoint is hit. Then, it's more like a choose your own adventure book: if the variable is nil, find out why and when. If the variable isn't nil, found out why your array controller is returning 0 items. This probably involves looking at what it is hooked up to and placing breakpoints on the methods that return results.

corbin


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to