I have two imageViews that I call firstView and secondView; I have to do an animation that move a third imageView that I call imageView3. This imageView3 is inside firstView and I do this code
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[imageView3 setFrame:frameinSecondView];
[UIView commitAnimations];
//[imageView3 removeFromSuperview];
//[secondView addSubview:imageView3];
with this code I can move imageView3 to secondView but the problem is that I’m not able to set imageView3 in the correct frame “frameinSeconView”; instead if I use the commented code
[imageToMove removeFromSuperview];
[scrollViewAlfabeto addSubview:imageToMove];
imageView3 go on the correct frame but I don’t see the animation because when it starts its animation, imageview3 disappear from firstView ad appear when it go on secondView
How Can I solve to have a correct animation, with a correct frame between these two imageViews.
You are trying to pass imageView3 from 1 to 2 right?
Remove it from imageView1 and place it on the windowView, do the animation from 1 to 2 and wait to end the animations to remove from windowView and insert into imageView2
how to wait? … well there is a [sentence something] structure that do that, but i dont know how is it, instead of that (cause ive never found how) i started to use “animation blocks” 😀
what is an animation block?
block: object that means an action;
below is an example of an animation using block objects block1, block2 (CODE PARTC)
It means that it will do actions defined in block1, as if they were inside begin-commit animation sentences, and (the beautiful part) after its COMPLETION they will do the actions in block2! :D!
but what is a f—-ng block?; well…
THIS IS A F—-NG BLOCK!:
Block that returns void (CODE PARTA):
Block that returns BOOL (after completion: you need a bool) and that have another animation inside (CODE PARTB)
I’ve used this to make a fake rotation of an image hohohoho
Anyways if u didnt got it, the order is PARTA,B,C 😛
Read this:
http://developer.apple.com/library/ios/#documentation/cocoa/Conceptual/Blocks/Articles/bxGettingStarted.html%23//apple_ref/doc/uid/TP40007502-CH7-SW1
is where i got how to use blocks :D, and heres an useful tutorial of the great RAYWENDERLICH:
http://www.raywenderlich.com/2454/how-to-use-uiview-animation-tutorial
Hope it helps!