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 4094070
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:41:53+00:00 2026-05-20T19:41:53+00:00

I have a little iPhone app that loads data from a web service. To

  • 0

I have a little iPhone app that loads data from a web service. To make sure that nothing goes wrong while loading the data I create a semi-transparent view over the app and use CFRunloopRun() to wait until all the data is loaded in the background. This is the code for that:

        self.connection = [[[NSURLConnection alloc] initWithRequest:request delegate:self] autorelease];

    // Now show an animation
    UIActivityIndicatorView *spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
    UIView *window = [[UIApplication sharedApplication] keyWindow];
    UIView *shield = [[UIView alloc] initWithFrame:window.bounds];
    shield.backgroundColor = [UIColor blackColor];
    shield.alpha = 0.5f;
    [window addSubview:shield];
    spinner.center = shield.center;
    [shield addSubview:spinner];
    spinner.hidden = NO;
    NSLog( @"JCL.callServerWithRequest(), spinner view: %@, shield view: %@, window: %@", spinner, shield, window );
    [spinner startAnimating];

    // Hand over to the Runnloop to wait
    CFRunLoopRun();

    [spinner stopAnimating];
    [spinner removeFromSuperview];
    [spinner release];
    [shield removeFromSuperview];
    [shield release];

This works fine except that any clicks on a button somewhere is played after the loading so if the users clicks on the download button twice he will do the download twice as well.

Any idea how to consume the UI events before the shield is removed.

Thanks – Andy

  • 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-20T19:41:53+00:00Added an answer on May 20, 2026 at 7:41 pm

    Try it without messing with runloops. I suspect that the UI events are coming in to the normal loop on the window but not being processed until your custom loop returns, at which point the “shield” view is no longer there to catch them. If you put the shield in place and then let the main runloop handle things, the shield should catch them all as normal.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form data from an iphone app that needs to send HTTP
I have an iPhone app that publishes through Bonjour. The Mac counterpart works, they
I have a simple iPhone app which accesses some remote data on start-up then
I have an iPhone app that communicates with a server (both of which I
I have a small IPhone app that I am working on and I am
I made a little app that does nothing to see if I could put
I'm programming an iPhone app that uses a little bit of javascript code for
I would like to begin work on an iPhone app that does little more
I've prototyped an iPhone app that uses (internally) SQLite as its data base. The
I have a little app that has been under development for some time. My

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.