看來,當我在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