Hi, I am making modifications to elements on UI. There is no (extra) thread or any async. calls. However I want to give a slow motion effect, so wait specific time at each step in a for loop. How can I achieve this without blocking the UI?
Specifically, I am moving a button in a for loop. I can put
[NSThread sleepForTimeInterval:5.0];
in the loop but button's position is not reflected on the UI until the loop ends; I think I should call something to 'redraw' the button at each for iteration.
Any ideas?
From stackoverflow
-
Better to use Core Animation if the modifications you are making are to animatable properties. For example, if you want to slowly change the frame of a view, you might do something like:
[UIView beginAnimations:@""]; [UIView setAnimationDuration:5.0]; view.frame = CGRectMake(0, 0, 320, 460); [UIView commitAnimations];
0 comments:
Post a Comment