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
Post a Comment