Re: UIImageView Animation Question
Re: UIImageView Animation Question
- Subject: Re: UIImageView Animation Question
- From: Philip Vallone <email@hidden>
- Date: Wed, 25 Nov 2009 18:49:57 -0500
Never mind,
I figured it out.
Regards,
UIImage *image = [UIImage imageNamed:@"top.png"];
UIImageView *imageView = [ [ UIImageView alloc ] initWithFrame:CGRectMake(295, 480/2, image.size.width, image.size.height) ];
imageView.image = image;
imageView.transform = CGAffineTransformMakeRotation(M_PI/2.0);
CGContextRef context = UIGraphicsGetCurrentContext();
[UIView beginAnimations:@"moveImageDown" context:context];
[UIView setAnimationDuration:1.0];
[imageView setCenter:CGPointMake(295, 480 / 2 )];
[UIView commitAnimations];
On Nov 25, 2009, at 6:36 PM, Philip Vallone wrote:
> Hi,
>
> I have a UIImageView that overlays a MPMoviePLayerController. When the movie plays, the view is in landscape. I want to have my overlay image to drop from the top of the movie and move down. The below code rotates the image. How do I get this effect?
>
>
> - (void)showOverlay:(NSTimer *)timer {
>
> NSArray *windows = [[UIApplication sharedApplication] windows];
>
> UIImage *image = [UIImage imageNamed:@"top.png"];
> UIImageView *imageView = [ [ UIImageView alloc ] initWithFrame:CGRectMake(0.0, 0.0, image.size.width, image.size.height) ];
> imageView.image = image;
> imageView.transform = CGAffineTransformMakeRotation(M_PI/2.0);
>
>
>
> CGFloat moveDistance = -50.0;
> CGContextRef context = UIGraphicsGetCurrentContext();
> [UIView beginAnimations:@"moveImageDown" context:context];
> [UIView setAnimationDuration:1.0];
> CGAffineTransform transform = CGAffineTransformMakeTranslation(0, moveDistance);
> [imageView setCenter:CGPointMake(295, 480 / 2 )];
> imageView.transform = transform;
> [UIView commitAnimations];
>
>
>
> mpw = [windows objectAtIndex:1];
> [mpw addSubview:imageView];
>
> }
>
> Thanks
>
> Phil
>
>
> _______________________________________________
>
> 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
_______________________________________________
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