Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7624095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:52:25+00:00 2026-05-31T04:52:25+00:00

I have a MasterViewController in a MAster Detail aplication showind data in a UITableView.

  • 0

I have a MasterViewController in a MAster Detail aplication showind data in a UITableView.

Data is loading from internet in batches, so while the first load of data arrives I show a UIView with download activity.

While no data is loaded on the UITableView the activity indicator view is not visible. Then after this data is loaded and the app keeps loading more the activity indicator view is shown.

My MasterViewController implements delegate methods to get notice when the download process starts and ends for every batch of data.

  • Why the UIView (self.downloadingProgrssView) loaded in AEMEventosListDidStartLoadingEventos: is not visible the first time the method is called?

Here is the code:

-(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];
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T04:52:26+00:00Added an answer on May 31, 2026 at 4:52 am

    The problem was I start the download process in the appController before I load the main view in ApplicationDidFinishLaunching. The first call to the delegate method was to fast and the main view of the app was not displayed when I was attaching my view.

    I just move the code to start downloading after this code in the applicationdidFinishLaunchingWithOptions method and everything start working Ok.

    self.navigationController = [[[UINavigationController alloc] initWithRootViewController:masterViewController] autorelease];
    self.navigationController.toolbarHidden = NO;
    self.window.rootViewController = self.navigationController;
    [self.window makeKeyAndVisible];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple Master-Detail application with a MasterViewController and a DetailViewController. Inside of
Have had to write my first proper multithreaded coded recently, and realised just how
Have you refactored from an ActiveRecord to a DataMapper pattern? What conditions prompted the
So I have a UITableView which should loop through a single NSMutableArray and use
In an iPhone app I'm developing, I grab a set of data from a
Have converted devise new session from erb to Haml but doens't work, this is
I have implemented a MGSplitViewController where I have 6 rows in the masterviewcontroller and
I'm using Xcode 4.2 and iOS SDK 5.0 and Apple's Master-Detail Application Template for
This is my first iPad/Storyboard/SplitViewController and it has a table as the master and
I have a superclass of UIViewController - MasterViewController which declares a property called itemsViewController

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.