MAITable 설명 표시 데이터가있는 MasterViewController가 UITableView에 있습니다.UITableView에 데이터가로드 될 때까지 MasterViewController에 추가 된 뷰가 표시되지 않습니다.
데이터가 인터넷에서 일괄 적으로로드되므로 데이터가 처음로드되는 동안 다운로드 작업이 포함 된 UIView가 표시됩니다.
UITableView에 데이터가로드되지 않은 동안 활동 표시기보기가 표시되지 않습니다. 그런 다음이 데이터가로드되고 앱이 계속로드되면 활동 표시기보기가 표시됩니다.
내 MasterViewController는 다운로드 프로세스가 모든 데이터 배치에 대해 시작되고 끝날 때 통지를 받기 위해 대리자 메소드를 구현합니다. AEMEventosListDidStartLoadingEventos:
에로드 된있는 UIView (self.downloadingProgrssView)이 메소드가 처음 호출 표시되지 않는 이유는
- ? 여기
코드입니다 :
-(void)AEMEventosListDidStartLoadingEventos:(AEMEventosList *)evList
{
// The views created here are not displayed the first time this method is called while the UITableView has no data.
//Once the TableView has been filled the followings calls to this method get the UIView displayed.
//Crear una vista con un idicador de progreso.
//Ancho y alto de activity Indicator
int widthAndHeigth = 30;
//Tamaño de activityIndicator
CGRect activityViewFrame = CGRectMake(10, 5, 20, 20);
//Tamaño de titleView
CGRect titleViewFrame = CGRectMake(widthAndHeigth + 20, 0, self.parentViewController.view.frame.size.width - widthAndHeigth, widthAndHeigth);
//Tamaño de downloadgingProgressView
CGRect downloadingProgressFrame = CGRectMake(0 + 20, self.parentViewController.view.frame.size.height - widthAndHeigth, self.parentViewController.view.frame.size.width - 40, widthAndHeigth + 13);
//Leyenda de la ventana.
NSString *title;
switch (evList.downloadingEventosGroupFlag) {
case 0:
title = NSLocalizedString(@"Downloading today's events", @"Downloading today's events leyend.");
break;
case 1:
title = NSLocalizedString(@"Downloading events in a week", @"Downloading events in a week leyend.");
break;
case 2:
title = NSLocalizedString(@"Downloading events in a month", @"Downloading events in a month leyend.");
break;
case 3:
title = NSLocalizedString(@"Downloading later events", @"Downloading later events leyend.");
break;
default:
title = @"";
break;
}
UIActivityIndicatorView *acView = [[UIActivityIndicatorView alloc] initWithFrame:activityViewFrame];
acView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite;
acView.hidesWhenStopped = NO;
acView.tag = kActivityIndicatorViewTag;
[acView startAnimating];
UILabel *titleView = [[UILabel alloc] initWithFrame:titleViewFrame];
titleView.text = title;
titleView.font = [UIFont systemFontOfSize:11];
titleView.backgroundColor = [UIColor clearColor];
titleView.textColor = [UIColor whiteColor];
titleView.tag = kNameViewTag;
UIView *aux = [[UIView alloc] init];
self.downloadingProgressView = aux;
[aux release];
self.downloadingProgressView.frame = downloadingProgressFrame;
self.downloadingProgressView.backgroundColor = [UIColor colorWithRed:0.3 green:0.4 blue:0.6 alpha:0.9];
// self.downloadingProgressView.tag = kDownloadingProgessViewTag;
downloadingProgressView.layer.cornerRadius = 13;
[self.downloadingProgressView addSubview:acView];
[self.downloadingProgressView addSubview:titleView];
[acView release];
[titleView release];
//Añadir la vista y animar
[self.parentViewController.view addSubview:self.downloadingProgressView];
[self.downloadingProgressView setFrame:CGRectMake(20.0f, 480.0f, 280.0f, 480.0f)]; //notice this is OFF screen!
[UIView beginAnimations:@"animateTableView" context:nil];
[UIView setAnimationDuration:0.5];
[self.downloadingProgressView setFrame:downloadingProgressFrame]; //notice this is ON screen!
[UIView commitAnimations];
}
-(void)AEMEventosListDidFinishLoadingEventos:(id)evList {
//Reasignar ls nueva lista de eventos descargada
self.eventosList = evList;
//Recargar la tabla
[self.tableView reloadData];
//Eliminar la vista de progreso de descarga y animar
[UIView beginAnimations:@"animateTableView" context:nil];
[UIView setAnimationDuration:0.5];
[self.downloadingProgressView setFrame:CGRectMake(20.0f, 480.0f, 280.0f, 480.0f)]; //notice this is OFF screen
[UIView commitAnimations];
self.downloadingProgressView = nil;
}
-(void)AEMEventosListDownloadingError:(AEMEventosList *)eventosList withError:(NSError *)error {
//Eliminar la vista de progreso de descarga
[[self.parentViewController.view viewWithTag:kDownloadingProgessViewTag] removeFromSuperview];
//Log el error
NSLog(@"%@", error);
//Mostrar un mensaje de error
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"Download error", @"Alert View title for download error")
message:[error localizedDescription]
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alertView show];
[alertView release];
}
그래서 질문은 어디에 있습니까? – NeverBe
그것이 명백했다. 그러나 아마 나의 영어는 명확하지 않다. 나는 명시적인 질문으로 업데이트했다. –
메인 스레드에서보기를 업데이트합니까? – NeverBe