• 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: becomeFirstResponder override issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: becomeFirstResponder override issue


  • Subject: Re: becomeFirstResponder override issue
  • From: Chris Anderson <email@hidden>
  • Date: Mon, 02 Feb 2009 18:53:29 -0800

Thanks Corbin. This oddity has led me down the path of why my awakeFromNib was being called twice so there was a flaw in my design. I have reworked becomeFirstResponder to use NSNotification instead and that seems to be working quite well.

Chris

On 2-Feb-09, at 1:12 PM, Corbin Dunn wrote:


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 (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


References: 
 >becomeFirstResponder override issue (From: Chris Anderson <email@hidden>)
 >Re: becomeFirstResponder override issue (From: Keary Suska <email@hidden>)
 >Re: becomeFirstResponder override issue (From: Chris Anderson <email@hidden>)
 >Re: becomeFirstResponder override issue (From: Keary Suska <email@hidden>)
 >Re: becomeFirstResponder override issue (From: Chris Anderson <email@hidden>)
 >Re: becomeFirstResponder override issue (From: Chris Anderson <email@hidden>)
 >Re: becomeFirstResponder override issue (From: Corbin Dunn <email@hidden>)

  • Prev by Date: Re: Read lines from very large text file
  • Next by Date: Re: Thai Dictionary
  • Previous by thread: Re: becomeFirstResponder override issue
  • Next by thread: Re: NSToolbar and constrolling visible items
  • Index(es):
    • Date
    • Thread