2

I'm wondering how to make a window "grow" like the Xcode's one when it opens... (of course I'm using Xcode to make that window, and I'm on Mountain Lion)

Josiah
  • 4,663
  • 2
  • 31
  • 49
user732274
  • 1,069
  • 1
  • 12
  • 28
  • I was not aware that the Xcode window did fade in? What are you talking about? Perhaps a screenshot or something. Of course, you could still do that on your app, I just don't believe Xcode does. Oh, and you mean on Cocoa right? – Josiah Dec 15 '12 at 20:27
  • I don't know how Xcode 4 behaves on Lion, but it fades on Mountain Lion. Yes, I'm talking about Cocoa – user732274 Dec 15 '12 at 20:28
  • I'm on Mountain Lion, but it does not fade. I just opened and closed the window multiple times. – Josiah Dec 15 '12 at 20:29
  • Maybe you used Onyx to kill the animations? – user732274 Dec 15 '12 at 20:30
  • Wait. I see. That is not fading, it is just an animation that extends the window from nothing, out. – Josiah Dec 15 '12 at 20:30
  • LOL you're right, I used I wrong verb. Thank you – user732274 Dec 15 '12 at 20:31
  • So the question is, do you want fading, or that "growing" animation? – Josiah Dec 15 '12 at 20:31
  • This is weird. This should be easy. Almost every big app uses it. Chrome, Firefox, Thunderbird, Xcode. Hmm... – Josiah Dec 18 '12 at 17:59
  • I would suggest following this: http://stackoverflow.com/questions/13953802/window-animation-in-mountain-lion-not-always-showing-upon-orderfront – Josiah Dec 19 '12 at 14:03

1 Answers1

1

For starters look here: https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSViewAnimation_Class/Reference/Reference.html

NSViewAnimation. Despite its name, it works on windows as well.

You can also look here: http://cocoadev.com/wiki/AnimatedWindowOpening

EDIT

I haven't tried this, but it looks promising. animationResizeTime: part of NSWindow, I believe should change the animation time. Now, I am assuming that all window actually have this animation, which I read somewhere that it does, however Xcode has extended the time. Perhaps .2 seconds wasn't enough.

That might only work if you use this: https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindow_Class/Reference/Reference.html#//apple_ref/occ/instm/NSWindow/setFrame:display:animate:

Good luck.

Edit

According to CodaFi, you can simply use this in the Interface Builder. Select your window and change this setting. However, I can not seem to get that too work. Therefore I am running out of ideas. You could also look at this, although not exactly what you mentioned, it may guide the right way: Resize NSWindows with easing animation

Solution

Community
  • 1
  • 1
Josiah
  • 4,663
  • 2
  • 31
  • 49
  • NSViewAnimation is an oversight IMHO. It should be deprecated. Also, there's a much simpler, system controller way, to animate windows the way he describes. – CodaFi Dec 15 '12 at 20:37
  • I was actually hoping there was. Are you aware of it. That is all I know, thought I would at least share my knowledge. However, it does seem like there should be an easier way. – Josiah Dec 15 '12 at 20:38
  • In IB, you can specify the window to animate in like a document. That's the easiest way. – CodaFi Dec 15 '12 at 22:17
  • Alright. Thanks. I was wondering what the Document Animation was. I'll edit my answer. – Josiah Dec 15 '12 at 22:39
  • This doesn't work for me: maybe this settings works only in conjunction with other settings... – user732274 Dec 16 '12 at 10:49
  • It didn't work for me either. I'll look more at it later, but you should look at animationResizeTime:. Perhaps the time is to short. – Josiah Dec 16 '12 at 13:04
  • Man. What is with people downvoting my answers. I gave all kinds of ways to solve this. I don't think that deserves a downvote. – Josiah Dec 18 '12 at 13:20