• 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: Problem setting up custom toolbar item in IB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem setting up custom toolbar item in IB


  • Subject: Re: Problem setting up custom toolbar item in IB
  • From: Graham Cox <email@hidden>
  • Date: Tue, 20 Jan 2009 17:34:37 +1100


On 20 Jan 2009, at 3:55 pm, Graham Cox wrote:

When my controller tries to set one of the field's values I get either a EXC_BAD_ACCESS, or an exception that NSData doesn't implement -setFloatValue:, but at awakeFromNib time I can see the text field outlets are set and are indeed NSTextFields. By the time the method is called to update the fields (a notification callback), the outlets have the same addresses but they point to garbage.


Seems I can't use a custom view here. If I change the view to NSBox, it works OK. I'm thinking this is because NSToolbar copies views using the archiving/dearchiving trick and a plain NSView doesn't implement NSCoding for its subviews (this actually surprises me however).

In this case I can use NSBox with a custom setting and it looks OK.

Next problem, my controller "loses" its connections to the fields in the toolbar item. Again, on reflection I should have expected this - the outlets are to the toolbar item's prototype view, not the copy that is placed into the toolbar. It looks as if I need to implement the toolbar delegate methods and fix up the connections manually, unless anyone has any better ideas?

--Graham


_______________________________________________

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: 
 >Problem setting up custom toolbar item in IB (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Problem setting up custom toolbar item in IB
  • Next by Date: Re: draw two strokes(lines) simultaneousy on NSView
  • Previous by thread: Re: Problem setting up custom toolbar item in IB
  • Next by thread: Search Fields, Array Controllers and Multiple NIBs
  • Index(es):
    • Date
    • Thread