您的位置:首页 > 理论基础 > 计算机网络

网络开始---多线程---阻塞主线程(演示)(一)

2015-09-18 00:42 435 查看
#import "ILViewController.h"

@interface ILViewController ()

@end

@implementation ILViewController

- (void)viewDidLoad
{
[super viewDidLoad];

//当前线程 ,判断这个方法在哪个线程中,可以打印这个线程,当num==1时,是在主线程中
//其他的在子线程中 ,不能把耗时的操作放在主线程中,所以不能把耗时的操作放在viewDidLoad方法里执行 耗时操作要放到非主线程中,后台线       程或者子线程中
[NSThread currentThread];

// Do any additional setup after loading the view, typically from a nib.
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
for (int i = 0; i<10000; i++) {
NSLog(@"---------%d", i);
}
}

@end
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: