1
votes

I have some animation blocks in my code which are causing my problems when I upgrade to iPhone OS4. I have read that it is now advised to use block-animations so I thought I would see if this solved my problems. Before I was using the following type of code to make an animation...

[UIImageView beginAnimations:nil context:NULL]; 

[UIImageView setAnimationDuration:30.0];

[UIImageView setAnimationRepeatCount:1e100f];

[UIImageView setAnimationCurve:UIViewAnimationCurveLinear];

[UIView setAnimationDelegate:self];

[UIView setAnimationDidStopSelector:@selector(stop)];

wheel.transform =CGAffineTransformMakeRotation(M_PI*-0.5);

[UIImageView commitAnimations];

I am now planning to change this to use this type of animation (taken from http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/doc/uid/TP40006816-CH3-SW111)

[UIView animateWithDuration:0.2

animations:^{ view.alpha = 0.0; }

completion:^(BOOL finished){ [view removeFromSuperview]; }]

My question is can I use the above block animation with UIImageView rather than UIView? Basically I guess I want to know what the difference is, if I animate a UIView would I just be animating a UIImage which is inside a UIView? Is this the same as a UIImageView then?!

Sorry I'm confused :-s

1

1 Answers

1
votes

UIImageView is a subclass of UIView, so everything that you can do with UIView can be also done with UIImageView.

If you animate UIView, animation would affect all its subviews. So in case you have UIImageView on top of UIView, animation of UIView would affect both - UIView and UIImageView.