• 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: How to (slowly) rotate a view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to (slowly) rotate a view


  • Subject: Re: How to (slowly) rotate a view
  • From: Matt Neuburg <email@hidden>
  • Date: Sat, 18 Aug 2012 10:18:15 -0700

On Mon, 06 Aug 2012 00:11:39 +0700, "Gerriet M. Denkmann" <email@hidden> said:
> I use this code (iOS 5.1):
>	CGAffineTransform m = { c, +s, -s, c, 0, 0 };	//	rotation, s = sin(angle), c = cos(angle)
>	CALayer *layer = self.view.layer;	//	view is UIView, self is subclass of UIViewController
>	[ CATransaction begin];
>	[ CATransaction setAnimationDuration: 9 ];
>	[ layer setAffineTransform: m ];
> 	[ CATransaction commit];
>The view rotates ok, but does it instantly, instead of taking 9 seconds.
>
>What am I doing wrong?

You are attempting to use implicit property animation (setAffineTransform:) on a view's primary layer. You can't do that; the property will change, but it won't animate. To get animation on that particular layer, you must use explicit animation (CABasicAnimation) or view animation. Explained here:

http://www.apeth.com/iOSBook/ch17.html

m.

--
matt neuburg, phd = email@hidden, <http://www.apeth.net/matt/>
A fool + a tool + an autorelease pool = cool!
Programming iOS 5! http://shop.oreilly.com/product/0636920023562.do
_______________________________________________

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

  • Follow-Ups:
    • Re: How to (slowly) rotate a view
      • From: "Gerriet M. Denkmann" <email@hidden>
  • Prev by Date: Re: loading UIView in correct orientation
  • Next by Date: Re: stripped down webview
  • Previous by thread: Re: How to (slowly) rotate a view
  • Next by thread: Re: How to (slowly) rotate a view
  • Index(es):
    • Date
    • Thread