1 #import "ILViewController.h" 2 3 @interface ILViewController () 4 5 @end 6 7 @implementation ILViewController 8 9 - (void)viewDidLoad10 {11 [super viewDidLoad];12 13 //當前線程 ,判斷這個方法在哪個線程中,可以打印這個線程,當num==1時,是在主線程中14 //其他的在子線程中 ,不能把耗時的操作放在主線程中,所以不能把耗時的操作放在viewDidLoad方法里執行 耗時操作要放到非主線程中,后臺線 程或者子線程中15 [NSThread currentThread];16 17 // Do any additional setup after loading the view, typically from a nib.18 }19 20 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event21 {22 for (int i = 0; i<10000; i++) {23 NSLog(@"---------%d", i);24 }25 }26 27 @end
新聞熱點
疑難解答