UPATE start
Correct answer is here:
Is it posible to do multiple animations on UIView without using completion block
No need to read this.
UPATE end
I have similar problem as UIView animateWithDuration returns immediately, but I can not use completion block because my animations are in different functions.
But do want to animate same object.
I am making card game, so I am moving card across the screen, but betwean moving I also have some game logic. So that why it is convenient for me to do animations as separate.
How to solve this ?
@Fogmeister
Problem with completion is following:
after method1, method2 is called.
If I want to call method1 52 times (because I have 52 cards), then method2 will also be called 52 times.
But in my scenario I need following, call method1 52 times, than call method2 4 times...
So I do not see how this can be down with competition.
Also sometimes I need to call method2 after method1, but sometimes I need to call method3 after method1...
I was thinking to make deep copy of objects after method1, and then on new object to call method2.
Will that work ?
@Fogmeister 2nd response
I have also come to same conclusion.
But I do not like it duo to following reasons.
I need to put game logic in animation logic, and I would like thing to be loosely coupled.
Animation code should not deal with game logic code.
What I want to do do is to do multiple animation, one after another one same UIView object, without using completion:, because I wont to keep animation code simple and reuse it also.
If you want you can download my code from
http://weborcode.com/dl/Tablic.zip
Animation is done in TBL_CardView.m file method animation*
and it is called from:
TBL_GameViewController.m file method gameStateMachineLoop
all card are shuffled from left to right, and then one card is send to left again.
But problem is that that card is already on the right before shuffle,
If you start the project you will se it.