How do I perform several methods in sequence?
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.
Example:
-(void)Method1
-(void)Met开发者_如何学Gohod2
-(void)Method3
[self Method1];
[self Method2];
[self Method3];
How do I force Method2 to begin execution only until Method1 has completed?
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?
It will be executed once Method1 returns, unless you're calling some method with delegate or background thread in Method1. Can you show us what's in Method1?
精彩评论