一个典型的结束子线程的方法: 用 isFinished 检测子线程是否被完全kill掉
-(IBAction)btnBack:(id)sender{ //释放内存 仅仅remove 并不会触发内存的释放 if (!(mySecondThread==nil) && !myFirstThread.isCancelled) { [myFirstThread cancel]; //等子线程结束再跳出循环 int i=0; while (!myFirstThread.isFinished){ NSLog(@"mySecondThread还没有结束 %i",i++); } } if (!(mySecondThread==nil) && !mySecondThread.isCancelled) { [mySecondThread cancel]; //等子线程结束再跳出循环 int j=0; while (!mySecondThread.isFinished){ NSLog(@"mySecondThread还没有结束 %i",j++); } } // 其它操作 }