Instance method from IB
Instance method from IB
- Subject: Instance method from IB
- From: Wade Williams <email@hidden>
- Date: Wed, 23 Dec 2009 10:15:27 -0600
Apologies for the newbishness of this question, but I've been away
from IB for quite some time (and never went very deep with it in the
first place).
Let's say I want to have two NSButtons (called 1 and 2) that will
cause an NSTabView to switch to tab 1 and 2, respectively. I don't
want to use the default segmented controller because I'm looking for
wide buttons arranged vertically.
Simple, right? Just hook the button to selectTabViewItemAtIndex.
Hmmm....but selectTabViewItemAtIndex is not an action method so that
won't work. Naturally, that makes sense because there's no way for a
simple NSButton to know it has to pass something for the index.
So some other solutions of which I can think:
1) Subclass the NSButton and have it call selectTabViewItemAtIndex
when pressed
2) Subclass the NSButton and have it respond to indexOfSelectedItem
as if it were a segmented controller. Then hook the button to
takeSelectedTabViewItemFromSender. While this will work, it seems
awfully hackish. Having a single button respond to a method clearly
intended for a group of items seems wrong.
Anything else? What am I missing? It seems like it should be simple
in IB alone to say "when this button is pressed, show this tab" but if
there's a way, it's escaping me.
Thanks for any input.
_______________________________________________
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