如何依次执行几种方法?

编程入门 行业动态 更新时间:2024-10-11 09:22:52
本文介绍了如何依次执行几种方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

强制按顺序执行方法的最佳方法是什么.我有三种方法,但我希望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?

更多推荐

如何依次执行几种方法?

本文发布于:2023-11-29 07:03:30,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1645683.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:几种方法

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!