Re: NSToolbarItems - deallocating view-based items
Re: NSToolbarItems - deallocating view-based items
- Subject: Re: NSToolbarItems - deallocating view-based items
- From: Steve Cronin <email@hidden>
- Date: Wed, 11 Feb 2009 00:04:09 -0600
Peter;
Thanks for the reply but....
.
The documentation for NSToolbarItem for =setView says:
"...The view for the receiver. The view and all of its contents must
conform to the NSCoding protocol if the toolbar supports
customization...."
There is no further discussion in the documentation.
One of the my view based items is just a simple NSSearchField.
NSSearchfield DOES conform to NSCoding.
Is it clarified anywhere in the documentation what else is necessary
to successfully customize a view based toolbar item?
I have declared the instance variable as an IBOutlet:
IBOutlet NSSearchField *searchFieldOutlet;
(I need the IBOutlets to fully utilize the toolbar item. functionality
in my controller code)
I have hooked this up in the usual way inside IB.
I just do not understand what you mean by "fresh".
Are you saying that I must instantiate them in code? ([... alloc]
init])
How do I hook this code instance as an IBOutlet?
Do I release after the "-
itemForItemIdentifier:willBeInsertedIntoToolbar:" method
I have more complex views than a single NSSearchField, how do I deal
with them?
Is the end result that you cannot use IB built view based toolbar
items if you intend to allow customization; that you must build the
entire view in code?
Could you explain just a bit more?
Steve
On Feb 10, 2009, at 5:47 PM, Peter Ammon wrote:
On Feb 9, 2009, at 7:13 PM, Steve Cronin wrote:
Folks;
I have a mix of view and image based toolbar items.
The views are all IBOutlets defined in IB.
Everything is working well - events are handled and items
arevalidated, everything is dandy.
Except when the user customizes the toolbar.
The image based items can be added and removed 'till the cows come
home
BUT the view based items - not so much...
They can be added and then they can be removed.
But once they are removed they cannot be re-added unless the
application is quit and restarted.
Attempting to re-add a view-based toolbar item that has been
removed causes a message like the following:
" -[NSSearchField retain]: message sent to deallocated instance
0x19b83490 "
Sooo what is the correct way to handle this?
I guess I'm puzzled by the IBOutlet aspect..
Hi Steve,
Make sure that your implementation of
toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar: returns a
toolbar item with a "fresh" view each time. That should take care
of this problem.
-Peter
_______________________________________________
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