本文介绍了如何依次执行几种方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
强制按顺序执行方法的最佳方法是什么.我有三种方法,但我希望method1在method2之前完成,然后在method2完成时执行method3.
What is the best way to force methods to be executed in sequence. I have three methods, but I want method1 to complete before method2 and then when method2 is complete, to execute method3.
示例:
-(void)Method1
-(void)Method2
-(void)Method3
[self Method1];
[self Method2];
[self Method3];
如何强制Method2仅在Method1完成之前开始执行?
How do I force Method2 to begin execution only until Method1 has completed?
推荐答案
除非Method1中有多线程代码,否则Method2仅在Method1完成时才开始执行.您从哪里得到在Method1仍在运行时Method2将开始执行的印象?
Unless if you have multi-threading code in Method1, Method2 will only begin execution when Method1 is completed. From where did you get the impression that Method2 will start executing while Method1 is still running?
这篇关于如何依次执行几种方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!