Obj C - Resizing Window Removes Window Items

旧街凉风 提交于 2019-12-12 00:43:44

问题


When I try to resize a window after a button is pressed, everything inside the window disappears and I believe it has to do with the origin of the window.

    NSRect frame = sender.window.frame;    
float d; //how much the window is changing
NSLog(@"the frame origin of y = %f", frame.origin.y);
d = (frame.size.height - 115);
NSLog(@"d variable = %f.", d);
frame.origin.y += d;
NSLog(@"the frame origin of y = %f", frame.origin.y);
frame.size.height = 115;
[sender.window setFrame:frame display:YES animate:YES];

The window is supposed to change its height to 115 and to ensure the top bar stays in the same place, the origin.y is adjusted however much the height had to change, yet when I test this, the top bar stays in the same place, but all the items inside the window disappear.

来源:https://stackoverflow.com/questions/9920025/obj-c-resizing-window-removes-window-items

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!