NSButton type not set properly

156 views Asked by At

I am having a mac app.

In which, I am creating a NSButton programmatically.

Here is my code below.

NSButton *myButton = [[NSButton alloc] initWithFrame:NSMakeRect(263, 265, 125, 148)];
        [[cleanNow contentView] addSubview: myButton];
        [myButton setImage:[NSImage imageNamed:@"scanbutton"]];
        [myButton setButtonType:NSMomentaryChangeButton];
        [myButton setWantsLayer:NO];
 [myButton setTarget:self];
        [myButton setAction:@selector(ScannowPressed:)];

so it shows like below image

I want an image only. Not that white background.

I know there is some silly mistake I am making in button type or somewhere. I have tried a lot but no luck.

Also, is it possible in mac OS X that we can show button in front lie we show in ios as bringsubviewtofront???

Please help me on this.

0

There are 0 answers