UIActivityIndicatorView回転していないまま親UITableView
-
25-09-2019 - |
質問
私はアプリを使用UITableViews、取得データからサーバーです。る試みを行っていますけUIActivityIndicatorViewの親UITableViewので、スピンの子どもUITableViewは出荷します。私のUIActivityIndicatorViewすべてのhookedupを通じてインタビルダー等
-(void)spinTheSpinner {
NSLog(@"Spin The Spinner");
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[spinner startAnimating];
[NSThread sleepForTimeInterval:9];
[self performSelectorOnMainThread:@selector(doneSpinning) withObject:nil waitUntilDone:NO];
[pool release];
}
-(void)doneSpinning {
NSLog(@"done spinning");
[spinner stopAnimating];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[NSThread detachNewThreadSelector:@selector(spinTheSpinner) toTarget:self withObject:nil];
NSMutableString *tempText = [[NSMutableString alloc] initWithString:[categoryNumber objectAtIndex:indexPath.row]];
Threads *viewController = [[Threads alloc] initWithNibName:@"newTable" bundle:nil tagval:tempText SessionID:PHPSESSID];
[self.navigationController pushViewController:viewController animated:YES];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
[viewController release];
}
なので、私は子どもUITableViewと、画面上のUIActivityIndicatorView(スピナー)に座り、親UITableView.を行った場合は、子UITableViewとして早期の親ビューを理解できUIActivitIndicatorViewを行いました。のNSLogsいての正しい回が初めてをタップする細胞の親UITableViewの"スピンのスピンナー"と表示されoff.............9秒後に取得しま"行の紡糸"、ログイン、スピナーな磁場合を除いてポップの親会UITableViewます。
アイデアはなぜこれがうまくいきませんか?
解決
おそらくsleepForTimeIntervalアニメーションをブロックしてます。
sleepForTimeIntervalを削除してみてくださいperformSelector:withObject:afterDelay:
を呼び出してperformSelectorOnMainThreadを置き換えます。
他のヒント
UI表示を聞かせて外ねじます:
[NSObject dispatchUI:^{
[spinner startAnimating];
}];
所属していません StackOverflow