thread about HA

1.转载 

[NSThread detachNewThreadSelector:@selector(delTargetBook) toTarget:self withObject:nil];


-(void)delTargetBook
{
NSAutoreleasePool *pool =[[NSAutoreleasePool alloc] init];
        //代码部分

        //代码部分
        //回主线程执行
[self performSelectorOnMainThread:@selector(didDelTargetBook) withObject:nil waitUntilDone:NO];
[pool release];
}

-(void)didDelTargetBook
{
[MBProgressHUD hideHUDForView:self animated:YES];
if ([delegate_ respondsToSelector:@selector(btnOfLibraryBookWasDelete:)]) {
[delegate_ btnOfLibraryBookWasDelete:self];
}
}
原文地址:https://www.cnblogs.com/halou/p/2105914.html