iOS在一个线程中运行多个操作

标签 ios objective-c nsthread nsoperationqueue

我是 iOS 开发线程的新手,我在这里有问题考虑以下代码

   [activityIndicator startAnimating];
   [self startAnewOperationInSepThread];
   [self startAnotherOperationInSepThread];

我的理解是当第一行执行时,事件指示器将在主线程中启动。所以现在主线程负责运行事件指示器。如何调用后续操作。

最佳答案

使用performSelectorInBackground

[self performSelectorInBackground:@selector(yourmethod:) withObject:nil];

关于iOS在一个线程中运行多个操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16371060/

相关文章:

ios - 防止调用静态库中的函数

ios - 以横向模式打开 UIImagePickerController

iphone - 我应该将图像保存在数据库中还是文件夹中?

iphone - 我怎么知道 AppDelegate 中的方向发生了变化

ios - 学习 Objective-C 的好资源/书籍

ios - Xcode 4.2.1 : NSThread causing memory leak, 使用 ARC

ios - 如何防止 Storyboard Segue 在 UIPopoverController 中重置 UIViewController

swift - block 没有真正执行?

iphone - 在此代码段中使用 NSThread

objective-c - Cocoa - NSThread 和急救人员