저는 UITableViewController가 있습니다. 특정 뷰를 스택에 푸시하면 영원히 걸리므로 이동하기 전에 셀에 회 전자를 추가하고 싶습니다. 내가 겪고있는 문제는 새로운 뷰가 컨트롤러 스택에 푸시 된 후에 스피너가 추가된다는 것입니다. 하지만 메시지가 동기 적이라고 생각 했나요?계산 작업이 많은 작업을 수행하기 전에보기에 회 전자를 추가하는 방법
그럼 다음보기로 이동하기 전에이 스피너 표시를 어떻게 만들 수 있습니까? 미리 감사드립니다!
- (void)
tableView: (UITableView *) tableView
didSelectRowAtIndexPath: (NSIndexPath *) indexPath {
UITableViewCell *cell = [ self.tableView cellForRowAtIndexPath: indexPath ];
if (cell.accessoryType == UITableViewCellAccessoryDisclosureIndicator) {
UIActivityIndicatorView *activityIndicator = [ [ UIActivityIndicatorView alloc ] initWithFrame: CGRectMake(260.0, 10.0, 25.0, 25.0) ];
activityIndicator.hidesWhenStopped = YES;
activityIndicator.activityIndicatorViewStyle = UIActivityIndicatorViewStyleGray;
[ cell addSubview: activityIndicator ];
[ activityIndicator startAnimating ];
TableDemoViewController *newViewController = [ [ TableDemoViewController alloc ] initWithPath: cell.textLabel.text ];
UINavigationController *navigationController = [ appDelegate navigationController ];
[ navigationController pushViewController: newViewController animated: YES ];
[ activityIndicator stopAnimating ];
}
}
지혜로운 것에 감사 드리며, 주 스레드에서 벗어나야한다는 것은 옳다. 고마워요! –