One Quickie


Resizing a window with animation (NSWindow->General)
Use setFrame:display:animate: to resize a window, and have the window animate between the two sizes. Remember that Cocoa uses a bottom-left origin, which is a pain when dealing with windows. You want the window's top left to be the same between the old and new sizes, so you have to dink with the origin as well as the size:
    float delta = ... how much to make the window bigger or smaller ...;
    NSRect frame = [window frame];

    frame.origin.y -= delta;
    frame.size.height += delta;

    [window setFrame: frame
             display: YES
             animate: YES];



borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book

webmonster@borkware.com