• 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: center-y constant animation won't animate
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: center-y constant animation won't animate


  • Subject: Re: center-y constant animation won't animate
  • From: Ken Thomases <email@hidden>
  • Date: Mon, 04 Aug 2014 18:17:45 -0500

On Aug 4, 2014, at 6:10 PM, Rick Mann <email@hidden> wrote:

> I'm setting the constant of a center-y-in-container constraint in a [UIView animateWith…] block, but it doesn't animate; it just jumps to the offset location. Any idea what I might be doing wrong? The code is pretty straightforward…
>
> 	https://pastee.org/edgsf
>
> I tried calling -animateWithDuration directly, and enqueueing it on the main queue (as seen here). Same result.
>
> Any help would be much appreciated.

There are two approaches, but I don't know if the second applies on iOS.

First, the way you did it, is to just set the constraint constant.  However, you then have to force layout.  The constraint itself is not being animated.  The changes to the frames that are done within the animation group are.  So, you need to call [self layoutIfNeeded] within the animation group.

The second way is to animate the constraint itself.  In this case, you change the constant on the constraint's animator proxy, not directly on the constraint.  So, you'd do self.logoVerticalConstraint.animator.constant = 100.

Cheers,
Ken


_______________________________________________

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: 
 >center-y constant animation won't animate (From: Rick Mann <email@hidden>)

  • Prev by Date: Re: center-y constant animation won't animate
  • Next by Date: Re: center-y constant animation won't animate
  • Previous by thread: Re: center-y constant animation won't animate
  • Next by thread: Re: Swift video/PDF files within the WWDC 2014 video list
  • Index(es):
    • Date
    • Thread