Mar*_*tin 14 multithreading objective-c ios
我在发展UIButton.
UIButton当我推动时,我正试图运行UIButton.
但我不能按下按钮,因为UIButton阻止了UIButton.
是否存在UIButton,我可以运行UIButton在UIButton并推UIButton?
提前致谢.
Com*_*mpy 31
就个人而言,我会在UI的顶部运行一个HUD活动指示器,然后在后台运行你的循环.
//Start the HUD here
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
//Run your loop here
dispatch_async(dispatch_get_main_queue(), ^(void) {
//stop your HUD here
//This is run on the main thread
});
});
Run Code Online (Sandbox Code Playgroud)
方式一:
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
// Write your code here
});
Run Code Online (Sandbox Code Playgroud)
方式2:
如果您使用performSelectorInBackground:withObject:生成一个新线程。
方式3:
[NSThread detachNewThreadSelector:@selector(yourMethod:) toTarget:self withObject:nil];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12907 次 |
| 最近记录: |