objective c - Window resizing problems in Xcode example -


i've downloaded apple's example glessentials. added programmatically window resizing in method awakefromnib in glessentialswindowcontroller class implementation:

-(void) awakefromnib {   nsrect rect = [view convertrecttobacking:nsmakerect(0,0,500,500)];   [self.window setframe:rect display:yes animate:no]; } 

here comes of fun. when doing such simple operation on working imac there no problems @ all. window size becomes expected. when doing operation on macbook window resizes value stored in .xib file. manually resize window new size , quit application. launch again. window resizes size window had @ last launch right before closed.

any suggestions?

as understood, nsopenglview class calls resize method after window initialized, that's why solution not allow window resize right after awakefromnib event remove resizable mask window styles:

[window setstylemask:[window stylemask] & ~nsresizablewindowmask]; 

so final solution like:

- (void) awakefromnib {  [self.window setstylemask:[self.window stylemask] & ~nsresizablewindowmask];  nsrect rect = [view convertrecttobacking:nsmakerect(0,0,500,500)];  [self.window setframe:rect display:yes animate:no]; } 

so target window resized 500 x 500, , doesn't matter size stored in .xib file.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

python - How to remove the Xframe Options header in django? -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -