Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make the NSWindow setFrame: .. animated:YES] function animated down instead of up?

When I call my [window setFrame: frame animated:YES] to enlarge the window it works great but it animates up and it goes behind the status bar. How can I make the window animate down instead?

like image 543
Ryan Detzel Avatar asked Dec 05 '22 00:12

Ryan Detzel


1 Answers

Just decrease the y coordinate the same distance you increase the height.

CGFloat amountToIncreaseWidth = 100, amountToIncreaseHeight = 100;
NSRect oldFrame = [window frame];
oldFrame.size.width += amountToIncreaseWidth;
oldFrame.size.height += amountToIncreaseHeight;
oldFrame.origin.y -= amountToIncreaseHeight;
[window setFrame:oldFrame animated:YES];
like image 169
ughoavgfhw Avatar answered May 16 '23 08:05

ughoavgfhw