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

  • Home
  • SEARCH
  • 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 8514509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:53:23+00:00 2026-06-11T04:53:23+00:00

I have an UIActivityIndicator that should loop until a PDF file is loading. I

  • 0

I have an UIActivityIndicator that should loop until a PDF file is loading.

I can’t understand why, but the indicator disappears before the PDF is loaded.
I can’t understand if the PDF file is too large (1,4 MB), if my app freezes, or if I wrote something wrong in the code

-(void)startTheProcess {

    act = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
    //coordinate act
    [act setCenter:CGPointMake(320 / 2, 440 / 2)];
    self.act.hidden = FALSE;
    [self.view addSubview:act];
    [act startAnimating];
    [UIApplication sharedApplication].networkActivityIndicatorVisible = TRUE;
    [NSThread detachNewThreadSelector:@selector(creaVista) toTarget:self withObject:nil];
}

- (void) creaVista{

    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    NSURL *url = [NSURL URLWithString:@"http://www.something.com/file.pdf"];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [pdfView loadRequest:request];
    [pdfView setScalesPageToFit:YES];
    [self performSelectorOnMainThread:@selector(processDone) withObject:nil waitUntilDone:NO];
    [pool release];
}
-(void)processDone {

    [act stopAnimating];
    [UIApplication sharedApplication].networkActivityIndicatorVisible = FALSE;
}

If I debug it, I can easily see that the debugger goes quickly to [act stopAnimating] and then stops, but the file is not yet loaded: after a few seconds the PDF appears.

Have you got any hints? I’m a noob and I think I’m doing some foolish mistakes…
Thanks

  • 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-06-11T04:53:25+00:00Added an answer on June 11, 2026 at 4:53 am

    It sounds like Joshua has the right idea in the comments. The load is asynchronous and will return before the load is actually done.

    If your pdfView is a UIWebView you can use the UIWebViewDelegate method webViewDidFinishLoad: to know when the PDF is done loading. If you place your [act stopAnimating] in there it should work.

    You would also want to place it in webView:didFailLoadWithError: incase there are any errors.

    To set the delegate on the pdfView do this: [pdfView setDelegate:self];
    and make sure that you have your controller adopt the UIWebViewDelegate like this:
    @interface ClassName : ItsSuperclass < UIWebViewDelegate >

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

Sidebar

Related Questions

I have implemented a UIActivityIndicator that shows up in one part of my program
I have a UIView *loadingView that simply has a black BG and a UIActivityIndicator
I am trying to show an indicator view when loading data in viewDidLoad but
I'm using a UIActivityIndicator inside a UIBarButtonItem to show activity, but the indicator is
Have an app that can use tts to read text messages. It can also
Have a query that should hopefully be nice and simple to answer. I have
I have a problem regarding UIActivityIndicator. I applied [spinner startAnimating] at the IBAction on
Have converted devise new session from erb to Haml but doens't work, this is
Have searched the database but need to specifically sum(of hours flown or days off)in
have anyone can tell me what syntax error on this actionscript (actionscript3.0)? var rotY:

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.