• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Resizing NSWindows and NSViews with NSViewAnimation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Resizing NSWindows and NSViews with NSViewAnimation


  • Subject: Re: Resizing NSWindows and NSViews with NSViewAnimation
  • From: Florent Pillet <email@hidden>
  • Date: Fri, 19 Oct 2007 10:27:56 +0200

I use a similar technique to perform vertical resize animation of subviews I've put in a scrollview, and handle width changes when the scrollbar appears / disappears. If you use NSViewAnimation, this won't work fine because the start and end frames are fixed (I tried changing them during the animation but it ended up crashing), so you'd get horrible aspect changes during animation.

To fix that, my NSAnimation delegate performs the frame changes using the same dictionary as NSViewAnimation, except that you can change the endFrame in the dictionary during the animation. I also play other tricks with setAutoresizesSubview: but that's another story...

Florent


Sanford Selznick wrote:
At 10:39 AM -0700 10/18/07, Sanford Selznick wrote:
Hello,

Is there a trick to moving and resizing views while also resizing the window? It's as if the origin is getting messed up as the window resizes and the animation is getting confused.

There is, actually. ;-)

First I tried removing all springs from the window's objects. This made all views position properly. But the animation with NSViewAnimation was horrible.

What I did instead was change the springs and struts at run-time with [myView setAutoresizingMask:mask]. Then I changed the frame of the window with [window setFrame:newFrame display:YES animate:YES].

This works really well, and it's many fewer lines than NSViewAnimation. At least when resizing windows is involved. (I guess this only works if the resizing/moving is proportional to the window size.)

-- Florent Pillet http://www.florentpillet.com Software consultant - Mobile devices, desktop and server platforms Windows+Mobile, Mac OS X, Palm OS Skype callto://florent.pillet _______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Resizing NSWindows and NSViews with NSViewAnimation (From: Sanford Selznick <email@hidden>)

  • Prev by Date: How to disable a tab of NSTabView?
  • Next by Date: Re: How to disable a tab of NSTabView?
  • Previous by thread: Resizing NSWindows and NSViews with NSViewAnimation
  • Next by thread: How to make NSComboBox work in fullscreen mode
  • Index(es):
    • Date
    • Thread