small medium large xlarge

Img_0048b_pragsmall
18 Nov 2008, 18:53
Bryan Wills (10 posts)

I am trying to animate 2 boxes moving apart and I want them to also rotate slightly as they move away from each other. The moving apart works fine, but I am not sure how to get them to rotate as well:

- (void)slideApart {
	[UIView beginAnimations:@"openSesame" context:nil]; 
	[UIView setAnimationDuration:2.0];
	[UIView setAnimationCurve: UIViewAnimationCurveEaseOut];
	[UIView setAnimationDelegate:self];
	[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:)];
	leftBox.center = CGPointMake(160.f, 50.f);
	rightBox.center = CGPointMake(160.f, 450.f);

// want to rotate them as well...is this possible?
leftBox.rotation = 30.f;

	[UIView commitAnimations];
}

Also on the subject of rotation, is it possible to rotate elements in Interface Builder? For example, I have a view in IB, add a UITextView (by dragging it into my view). I want to rotate the text 90degrees (typically done in other IDEs by grabbing a corner of the bounding box and dragging to spin). Is this possible in IB? If not, how do I rotate that UITextView back in xcode?

Thanks-B

Biopic_100x100_pragsmall
18 Nov 2008, 19:42
Bill Dudney (917 posts)

Hi Bryan,

For both rotation issues you need to use the transform property on the view.

HTH!

You must be logged in to comment