It appears that when I send a window in a mac application this:
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];
Although it appears to stretch down longer, none of the UI elements (buttons) recognize the window has more space. They cannot move into the new space opened up.
I have a few buttons that are supposed to stay right at the button of the window, which I use the following in conjunction with the code above to keep them together:
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;
Yet when they hit the old dimensions of the window, they start to disappear. Even the window appears to be longer. Thank you.
EDIT: Looked at autosizing for the window itself. Realizing the problem has to do with the NSView within the window. That view holds all the UI elements and it appears that it does not change when the window changes. Only problem now is, I can't figure out how to extend the View from the bottom, and not from the top. (It won't work to increase the top and shift the origin because all the UI elements move with the NSView).
The buttons were disappearing because the origin of the view wasn't keeping up with the movement of the window. The following gets it to seamlessly move the window and view together... since I didn't set linked properly but it works fine as is:
[mainWindow disableScreenUpdatesUntilFlush];
[mainWindow disableFlushWindow];
NSRect frame = sender.window.frame;
NSRect viewFrame = mainView.frame;
viewFrame.size.height += 25;
frame.size.height += 25;
frame.origin.y -= 25;
[sender.window setFrame:frame display:YES animate:NO];
mainView.frame = viewFrame;
[mainWindow enableFlushWindow];
The problem is probably how you set up the autosizing. If you activate the top strut only, it should behave as you want