Re: UIImageView Animation Question
On Thu, 26 Nov 2009 22:27:39 -0800, David Duncan david.dun...@apple.com said: The context parameter for beginAnimations:context: is just meant as a token for you to use should you use the callbacks that let you know about the progress of the animation. The value is completely arbitrary It's really another case of a poor choice of terminology, isn't it? (By another I am referring to my recent critique on this list of the confusing over-use of the term key throughout the animation stuff.) Here we are in a graphics world, so the user must be forgiven for supposing that context is asking for a graphics context. If the name-mongers had used contextInfo as elsewhere in Cocoa, the purpose of this parameter would have been much more obvious. m. -- matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/ A fool + a tool + an autorelease pool = cool! AppleScript: the Definitive Guide - Second Edition! http://www.tidbits.com/matt/default.html#applescriptthings ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: UIImageView Animation Question
On Nov 27, 2009, at 2:02 PM, Matt Neuburg wrote: It's really another case of a poor choice of terminology, isn't it? (By another I am referring to my recent critique on this list of the confusing over-use of the term key throughout the animation stuff.) Here we are in a graphics world, so the user must be forgiven for supposing that context is asking for a graphics context. If the name-mongers had used contextInfo as elsewhere in Cocoa, the purpose of this parameter would have been much more obvious. m. I'm not a name monger by any means, but in this case I would say that since the type of the parameter is void* implies that there is no relation. If the parameter had been meant to always be a CGContextRef, then it would have been typed as such. Similarly, if it was meant to always be an object type, it would be at least of type id. And of course, its purpose is spelled out clearly from the documentation :). -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: UIImageView Animation Question
On Fri, 27 Nov 2009 15:53:30 -0800, David Duncan david.dun...@apple.com said: On Nov 27, 2009, at 2:02 PM, Matt Neuburg wrote: It's really another case of a poor choice of terminology, isn't it? (By another I am referring to my recent critique on this list of the confusing over-use of the term key throughout the animation stuff.) Here we are in a graphics world, so the user must be forgiven for supposing that context is asking for a graphics context. If the name-mongers had used contextInfo as elsewhere in Cocoa, the purpose of this parameter would have been much more obvious. m. I'm not a name monger by any means, but in this case I would say that since the type of the parameter is void* implies that there is no relation. If the parameter had been meant to always be a CGContextRef, then it would have been typed as such. Similarly, if it was meant to always be an object type, it would be at least of type id. And of course, its purpose is spelled out clearly from the documentation :). All of what you're saying is perfectly true. But what I'm saying is *also* true. m. -- matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/ A fool + a tool + an autorelease pool = cool! AppleScript: the Definitive Guide - Second Edition! http://www.tidbits.com/matt/default.html#applescriptthings ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: UIImageView Animation Question
On Nov 25, 2009, at 3:49 PM, Philip Vallone wrote: CGContextRef context = UIGraphicsGetCurrentContext(); [UIView beginAnimations:@moveImageDown context:context]; [UIView setAnimationDuration:1.0]; [imageView setCenter:CGPointMake(295, 480 / 2 )]; [UIView commitAnimations]; Keep in mind that the call to UIGraphicsGetCurrentContext() here is superfluous, and likely returning NULL. You can remove it without making any change on the behavior of your code. -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: UIImageView Animation Question
Hi David, Thanks for the reply. When I remove the reference to UIGraphicsGetCurrentContext() my Image doesn't drop in. Removed: CGContextRef context = UIGraphicsGetCurrentContext(); [UIView beginAnimations:@moveImageDown context:context]; The following code works: imageView = [ [ UIImageView alloc ] initWithFrame:CGRectMake(295, 480/2, image.size.width, image.size.height) ]; imageView.image = image; imageView.transform = CGAffineTransformMakeRotation(M_PI/2.0); imageBottomView = [ [ UIImageView alloc ] initWithFrame:CGRectMake(-220, 207, imageBottom.size.width, imageBottom.size.height) ]; imageBottomView.image = imageBottom; imageBottomView.transform = CGAffineTransformMakeRotation(M_PI/2.0); pos = 295; CGContextRef context = UIGraphicsGetCurrentContext(); [UIView beginAnimations:@moveImageDown context:context]; [UIView setAnimationDuration:2.0]; [imageView setCenter:CGPointMake(pos, 480 / 2 )]; [UIView commitAnimations]; [mpw addSubview:imageView]; Thoughts? On Nov 26, 2009, at 1:13 PM, David Duncan wrote: On Nov 25, 2009, at 3:49 PM, Philip Vallone wrote: CGContextRef context = UIGraphicsGetCurrentContext(); [UIView beginAnimations:@moveImageDown context:context]; [UIView setAnimationDuration:1.0]; [imageView setCenter:CGPointMake(295, 480 / 2 )]; [UIView commitAnimations]; Keep in mind that the call to UIGraphicsGetCurrentContext() here is superfluous, and likely returning NULL. You can remove it without making any change on the behavior of your code. -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: UIImageView Animation Question
On Nov 26, 2009, at 11:31 AM, Philip Vallone wrote: Hi David, Thanks for the reply. When I remove the reference to UIGraphicsGetCurrentContext() my Image doesn't drop in. Removed: CGContextRef context = UIGraphicsGetCurrentContext(); [UIView beginAnimations:@moveImageDown context:context]; Thoughts? I said to remove the call to UIGraphicsGetCurrentContext(), you need the call to +beginAnimations:context: :). The context parameter for beginAnimations:context: is just meant as a token for you to use should you use the callbacks that let you know about the progress of the animation. The value is completely arbitrary, and in most cases will be a pointer to some class or data structure of your own design. If you don't need the context, then feel free to pass NULL (which given the circumstances around which you are calling UIGraphicsGetCurrentContext() is likely the value you are already passing). -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: UIImageView Animation Question
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 (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/philip.vallone%40verizon.net This email sent to philip.vall...@verizon.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com