通过performSelectorOnMainThread调用方法调用普通方法

编程入门 行业动态 更新时间:2024-10-15 00:24:54
本文介绍了通过performSelectorOnMainThread调用方法调用普通方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当我使用 performSelectorOnMainThread 调用方法并且在没有performSelector的情况下调用相同的方法时,任何人都可以告诉我有什么不同。

can any one tell me what is different when I call method using performSelectorOnMainThread and calling same method without performSelector.

Exa。

-(void)sampleCALL{ .......... }

现在使用这两个参数调用此方法:

NOW Call this method using these two senario:

[[self performSelectorOnMainThread:@selector(sampleCALL) withObject:nil waitUntilDone:NO];];

[self sampleCALL];

如何执行这两种方法? 请帮我正确找到这个概念。

How these two method are getting executed? Please help me to find this concept properly.

推荐答案

第一个案例 [self sampleCALL]; 您的方法将在当前控制的线程中调用。它将保持所有堆栈操作,它为从另一个方法调用方法做了什么。

in firs one case [self sampleCALL]; your method will be called in the thread where control was at current time. it will maintain all the stack manipulation what it does for method calling from another method.

while

[[self performSelectorOnMainThread:@selector(sampleCALL) withObject:nil waitUntilDone:NO];];

调用主线程中的方法,无论控件当前线程是什么。所有UI操作始终在主线程中执行。

calls the method in main thread whatever the controls current thread is. All UI actions are performed in main thread always.

更多推荐

通过performSelectorOnMainThread调用方法调用普通方法

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

发布评论

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

>www.elefans.com

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