Adding a NSButton as a subview over IKImageFlowView

517 Views Asked by At

I am using IKImageFlowView in my application and need to add a nsbutton over it,

I am using the code as given below,

In my .h file IBOutlet id browserView;

in nib added a custom view and changed its class as myImageFlowView as I am subclassing from IKImageFlowView as

@interface myImageFlowView : IKImageFlowView

and in my appController class I am trying to add button to browserView with following code snippet,

NSRect initialFrame = NSMakeRect(20.0, 50.0, 100.0, 100.0); 
NSButton *myBtn = [[NSButton alloc] init]; 
[myBtn setFrame:initialFrame]; 
[myBtn setBordered:NO];  
[myBtn setAutoresizesSubviews:TRUE]; 
[myBtn.cell setImageScaling:NSImageScaleAxesIndependently];
[myBtn setImage:[NSImage imageNamed:@"AppleColor.png"]]; 
[browserView addSubview:myBtn]; 

I am not able to add this button as a subview to IKImageFlowView,I can add button to NSView. What I am doing wrong.Please help.

0

There are 0 best solutions below