objective c - NSButton not locked -


i'm trying make nsview programmatically , i'm tad stuck. don't gui programming , first time trying create view. fine until try resize window. button doesn't stay 'pinned' in position. keeps moving around in view. code below:

-(void) awakefromnib { nsview *test=[[nsview alloc] initwithframe:windowrect]; button=[[nsbutton alloc]initwithframe:nsmakerect(window.frame.origin.x-10.0,  window.frame.origin.y+50.0, 80.0, 50.0)]; [button setbezelstyle:nsroundedbezelstyle]; window.title=@"window test"; [button settitle:@"click me"]; [button needsdisplay]; [test addsubview:button]; [[window contentview] addsubview:test]; [window makekeyandorderfront:nil]; [[window contentview] setautoresizessubviews:yes]; } 

the button object regular nsbutton.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -