我在 uitableviewcell 的 didselectrow 方法上使用它
[NSThread detachNewThreadSelector:@selector(showMyWaitView) toTarget:self withObject:nil];
它工作正常,但它在 gdb 中显示这样的错误
2009-08-10 12:45 : 01.313闪存卡[1209:6307] 10 12:45 :01.314抽认卡[1209:6307]
我也试过计时器,但没用
我的定时器代码是这个
MyTimer = [NSTimer timerWithTimeInterval:0.01 target:self 选择器:@selector(showMyWaitView) userInfo:nil repeats:NO]; [[NSRunLoop mainRunLoop] addTimer:MyTimer forMode: NSDefaultRunLoopMode];
我也试过这个
MyTimer = [NSTimer scheduledTimerWithTimeInterval:0.0001 target:self selector:@selector(showMyWaitView) userInfo:nil repeats:NO];
[NSThread sleepForTimeInterval:0.03];
这是我的 showMyWaitView 方法
-(void)showMyWaitView
{
[self.view addSubview:MyWaitViewObj.view];
}
这是我做的 selectrow 方法
if(MyWaitViewObj==nil)
{
MyWaitViewObj = [[MyWaitViewController alloc] initWithNibName:@"MyWaitView" bundle:nil];
}
//MyTimer = [NSTimer scheduledTimerWithTimeInterval:0.0001 target:self selector:@selector(showMyWaitView) userInfo:nil repeats:NO];
MyTimer = [NSTimer timerWithTimeInterval:0.01 target:self selector:@selector(showMyWaitView) userInfo:nil repeats:NO];
[[NSRunLoop mainRunLoop] addTimer:MyTimer forMode: NSDefaultRunLoopMode];
[NSThread detachNewThreadSelector:@selector(showMyWaitView) toTarget:self withObject:nil];
//[NSThread sleepForTimeInterval:0.03];
[indexTableView deselectRowAtIndexPath:indexPath animated:YES];
categoryId = [[listOfCategoryId objectAtIndex:indexPath.section] intValue];
categoryType=[[listOfCategoryType objectAtIndex:indexPath.section] intValue];
[self getFlashCard:categoryId];
flashcardid = [[flashCardsId objectAtIndex:indexPath.row] intValue];
//NSLog(@"%s %d %s", __FILE__, __LINE__, __PRETTY_FUNCTION__, __FUNCTION__);
if(MyPageViewControllerObj==nil)
{
MyPageViewController *vController= [[MyPageViewController alloc] initWithNibName:@"MyPageView" bundle:[NSBundle mainBundle]];
self.MyPageViewControllerObj=vController;
[vController release];
}
//
MyPageViewControllerObj.sessionid=sessionid;
MyPageViewControllerObj.categoryID = categoryId;
MyPageViewControllerObj.flashcardIdforcount = flashcardid;
MyPageViewControllerObj.categoryType=categoryType;
MyPageViewControllerObj.indexViewControllerobj=self;
[self.navigationController pushViewController:MyPageViewControllerObj animated:YES];
[MyPageViewControllerObj refreshMyPageView];
//[MyPageViewControllerObj release];
NSLog(@"My MySlidingController View Ka retain Count=%d",[MyPageViewControllerObj retainCount]);
[MyWaitViewObj.view removeFromSuperview];
如何使用计时器显示活动指示器请帮助我或告诉我此 gdb 错误是否会导致应用程序崩溃