Re: Custom View in Toolbar
Re: Custom View in Toolbar
- Subject: Re: Custom View in Toolbar
- From: Quincey Morris <email@hidden>
- Date: Mon, 8 Mar 2010 11:34:41 -0800
On Mar 8, 2010, at 10:58, David Blanton wrote:
> When I build and run the view is not visible. So I read about validating tool bar items:
>
> [snip]
>
> I have sub classed as suggested:
>
> @interface View : NSToolbarItem {
> @public
>
> }
>
> @end
>
>
> @implementation View
>
> - (void)validate {
>
> [self setEnabled:YES];
>
> }
>
> @end
>
>
> and set this class to be the class of the enclosing tool bar item: http://highrolls.net/Picture 2.png
>
> The buttons do not display.
Yes, but I don't see how you're getting from the view contents not being visible to playing around with validation. Disabled buttons aren't invisible, they're dimmed. Therefore, if they're invisible, it's unlikely that validation is at fault. Or, at least, that isn't where I'd start looking.
> I then added outlets for the buttons and tried to enable them (yes, I realize that I if they were disabled I would see them in a disabled state) but I am grasping at straws now. Doing this caused EXEC_BAD_ACCESS the second time validate was called.
Yes, and it seems very likely that what's causing the crash at this point is related to why the buttons aren't visible. Prime suspect is a memory management error.
If, for example, a reference to the toolbar item's view isn't being retained properly, the view and its contents would get deallocated. That would certainly result in nothing being drawn, and would very likely cause the exact crash you describe.
A repeatable crash is your best friend when trying to solve a problem like this. If you find out why, the chances are you'll have found the original issue too.
_______________________________________________
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