I tried and nothing. The IBOutlet is on the NSToolbarItem custom class. Here is 
my custom class:

@interface RBSStopButtonToolbarItem : NSToolbarItem
{
    NSButton *_button;
}

@property (readwrite) NSButton *button;

@end

@implementation RBSStopButtonToolbarItem

@synthesize button = _button;

-(id)initWithItemIdentifier:(NSString *)itemIdentifier
{
    self = [super initWithItemIdentifier:itemIdentifier];



    if(self)
    {
        // set min and max size
        [self setMinSize:NSMakeSize(32.0, 32.0)];
        [self setMaxSize:NSMakeSize(32.0, 32.0)];



        NSLog(@"Self: %@", self);



    }
    return self;
}

-(void)validate
{
    NSLog(@"Validate called...");
    // set the original and alternate images...names are "opposite"



    _button = [[NSButton alloc] initWithFrame:NSMakeRect(0, 0, 32, 32)];



    //[_button setFrameSize:NSMakeSize(32.0, 32.0)];



    NSImage *image = [NSImage imageNamed:@"StopButtonAlternateIcon"];
    [image setSize:NSMakeSize(32.0, 32.0)];
    [_button setImage:image];



    image = [NSImage imageNamed:@"StopButtonIcon"];
    [image setSize:NSMakeSize(32.0, 32.0)];
    [_button setAlternateImage:image];



    // image position
    [_button setImagePosition:NSImageOnly];



    // set button type
    [_button setButtonType:NSToggleButton];



    // button is transparent
    [_button setBordered:NO];



    // set the toolbar item view to the button
    [self setView:_button];
}

@end

The images will display, but the action does not seem to “connect”, even though 
it is done in IB.

On Apr 24, 2014, at 11:47 PM, Andy Lee <ag...@mac.com<mailto:ag...@mac.com>> 
wrote:

On Apr 24, 2014, at 11:15 PM, "Peters, Brandon" 
<bap...@my.fsu.edu<mailto:bap...@my.fsu.edu>> wrote:
My button is inside the customer toolbar item, if I make the button an outlet, 
how will I connect to it in IB?

You can do it in code when you set it up.  See setAction: and setTarget:.

I don't know for sure if that'll work -- it's the only guess I can come up with.

--Andy



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to