disable beginSheet animation

  • How do I disable the animation of [NSApp
    beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo].

    Apple document says that "Other sheet behavior, such as the animation when
    it appears and is dismissed, is handled automatically by the Application
    Kit."

    Thanks,
    Peng
  • Found the answer.

    By setting the animation speed to a low value (not 0, otherwise 0.2 is used
    by default)

    [[NSUserDefaults standardUserDefaults] setFloat:0.00001 forKey:
    @"NSWindowResizeTime"];

    [NSApp beginSheet:....]

    [[NSUserDefaults standardUserDefaults] setFloat:0.2 forKey:
    @"NSWindowResizeTime"];

    Thanks,

    On Fri, May 17, 2013 at 5:50 AM, Peng Gu <panygu...> wrote:

    > How do I disable the animation of [NSApp
    > beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo].
    >
    > Apple document says that "Other sheet behavior, such as the animation
    > when it appears and is dismissed, is handled automatically by the
    > Application Kit."
    >
    > Thanks,
    > Peng
    >
  • The documentation says that the default resize period is subject to change between OS releases, and it's possible others will have changed it on their own. (I've run into people who are at war with animations, and would be furious if their settings were undone.) You should collect the value before changing it, so you can restore it exactly afterwards.

    A question: Why do you want a sheet to pop into view instead of acting as users expect? I am willing to trust you have a good reason, but I'm curious.

    — F

    On 16 May 2013, at 5:03 PM, Peng Gu <panygu...> wrote:

    > Found the answer.
    >
    > By setting the animation speed to a low value (not 0, otherwise 0.2 is used
    > by default)
    >
    > [[NSUserDefaults standardUserDefaults] setFloat:0.00001 forKey:
    > @"NSWindowResizeTime"];
    >
    > [NSApp beginSheet:....]
    >
    > [[NSUserDefaults standardUserDefaults] setFloat:0.2 forKey:
    > @"NSWindowResizeTime"];
    >

    --
    Fritz Anderson
    Xcode 4 Unleashed: 4.5 supplement for free!
    http://www.informit.com/store/xcode-4-unleashed-9780672333279
  • It seems that once you changed the speed value, you can't restore it. Other
    sheets including the open, save panels will use the new value.

    So in the end, I decided not to do it.

    > A question: Why do you want a sheet to pop into view instead of acting as
    users expect? I am willing to trust you have a good reason, but I'm curious.

    I wanted it to appear immediately because my popovers don't use animation.
    Turns out showing sheets without animation looks awkward, and has the
    non-restorable side effect.

    On Fri, May 17, 2013 at 6:18 AM, Fritz Anderson <fritza...>wrote:

    > The documentation says that the default resize period is subject to change
    > between OS releases, and it's possible others will have changed it on their
    > own. (I've run into people who are at war with animations, and would be
    > furious if their settings were undone.) You should collect the value before
    > changing it, so you can restore it exactly afterwards.
    >
    > A question: Why do you want a sheet to pop into view instead of acting as
    > users expect? I am willing to trust you have a good reason, but I'm curious.
    >
    > — F
    >
    > On 16 May 2013, at 5:03 PM, Peng Gu <panygu...> wrote:
    >
    >> Found the answer.
    >>
    >> By setting the animation speed to a low value (not 0, otherwise 0.2 is
    > used
    >> by default)
    >>
    >> [[NSUserDefaults standardUserDefaults] setFloat:0.00001 forKey:
    >> @"NSWindowResizeTime"];
    >>
    >> [NSApp beginSheet:....]
    >>
    >> [[NSUserDefaults standardUserDefaults] setFloat:0.2 forKey:
    >> @"NSWindowResizeTime"];
    >>
    >
    > --
    > Fritz Anderson
    > Xcode 4 Unleashed: 4.5 supplement for free!
    > http://www.informit.com/store/xcode-4-unleashed-9780672333279
    >
    >
previous month may 2013 next month
MTWTFSS
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
Go to today