uitableviewcellのdidselectrowメソッドでこれを使用しています
[NSThread detachNewThreadSelector:@selector(showMyWaitView) toTarget:self withObject:nil];
正常に動作しますが、このようにgdbにエラーが表示されます
2009-08-10 12:45:01.313 Flashcards [1209:6307] * _nsautorleaseNopool():オブジェクト0x458200クラスUiviewオートリリースはプールを所定の位置に漏らしていない - (0x907d7adf 0x906e41f2 0x29a6022222020222222029a6022222029a6 10 12:45:01.314フラッシュカード[1209:6307] * _NSAUTORLEASENOPOOL():クラスNSCFストリングのオブジェクト0x2A0E8オートリリースされているプールがあります。
タイマーも試しましたがダメでした
私のタイマーコードはこれです
MyTimer = [NSTimer timerWithTimeInterval:0.01 target:self selector:@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];
タイマーを使用してアクティビティ インジケーターを表示する方法