开发者

iPhone - Waiting beetween 2 code line for asynchronous task to be done

I have two lines of code that are executed just before the pop of a view. Those two lines are making some scrolling. Because of those 3 animations, there are many things that the user don't see, or let's say don't see well.

I don't want to use callbacks to deal with this. I just need the app to wait s开发者_运维百科ome 0,5 secs for the view to pop, and 0,5 secs more beetween the two scroll calls to let him see what is happening.

How may I do this easily without stopping the animations ?

I tried (quickly) [NSThread sleepForTimeInterval:0.5]; but it stops everything. Of course.


You can't wait for an animation to finish from the main UI thread without exiting from the current method after the first line and using a callback for the second line.

If you don't like callbacks, your alternative is to queue your two lines for execution in a background thread.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜