看来,当我在Mac应用程序发送窗口这样的:的OBJÇ - 可用的窗口区域
NSRect frame = sender.window.frame;
NSLog(@"\nHeight and width of window frame: (%f,%f).\nThe x and y origin of the window frame: (%f,%f). ", frame.size.height, frame.size.width, frame.origin.x, frame.origin.y);
frame.origin.y -= 22;
frame.size.height += 22;
[sender.window setFrame:frame display:YES animate:NO];
尽管看上去下来再舒展,没有任何UI元素(按钮)的识别窗口有更多的空间。他们无法进入开放的新空间。
我有,都应该在窗口的按钮呆在几个按钮,我用下面结合上面的代码,让他们在一起:
CGRect quitBF = quitButton.frame;
quitBF.origin.y -= 5; // new y coordinate
quitButton.frame = quitBF;
CGRect loadBF = loadButton.frame;
loadBF.origin.y -= 5; // new y coordinate
loadButton.frame = loadBF;
CGRect saveBF = saveButton.frame;
saveBF.origin.y -= 5; // new y coordinate
saveButton.frame = saveBF;
CGRect resetBF = resetButton.frame;
resetBF.origin.y -= 5; // new y coordinate
resetButton.frame = resetBF;
然而,当他们打窗户的旧尺寸,他们开始消失。即使窗户看起来更长。谢谢。
编辑:看着自动窗口本身。意识到这个问题与窗口内的NSView有关。该视图包含所有UI元素,并且它看起来在窗口更改时不会更改。现在唯一的问题是,我无法弄清楚如何从底部扩展视图,而不是从顶部扩展视图。 (因为所有UI元素都随着NSView一起移动,所以不会增加顶部和移动原点)。
我不认为这个问题是在此代码发布 - - 我把它粘贴到一个项目中,它运行良好。 IB中的窗口和按钮是否设置? – rdelmar 2012-04-06 04:00:06
是的。所有这些都是在IB中首次设置的。 – 2012-04-06 04:43:05