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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:46:35+00:00 2026-05-18T04:46:35+00:00

I created a UIProgressView . But i used NSTimer to UIProgressView’s process . Now

  • 0

I created a UIProgressView. But i used NSTimer to UIProgressView's process . Now I need to integrate UIProgressView process, when URL is loading. UIProgressView's size will be depends upon the NSURLConnection's data.

I used the following code to NSURLConnection.

-(void)load {
    NSURL *myURL = [NSURL URLWithString:@"http://feeds.epicurious.com/newrecipes"];
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:myURL
                                                           cachePolicy:NSURLRequestReloadIgnoringLocalCacheData
                                                       timeoutInterval:60];

    [[NSURLConnection alloc] initWithRequest:request delegate:self];
}

-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
    responseData = [[NSMutableData alloc] init];
}


-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
    [responseData appendData:data];
}

-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
    [connection release];

    UIAlertView *alert = [[UIAlertView alloc] init];
    [alert setTitle:@"Warning"];
    [alert setMessage:@"Network Connection Failed?"];
    [alert setDelegate:self];
    [alert addButtonWithTitle:@"Yes"];

    [alert show];
    [alert release];

    NSLog(@"Error");
}

-(void)connectionDidFinishLoading:(NSURLConnection *)connection 
{
    responsetext = [[[NSString alloc] initWithData:responseData encoding: NSASCIIStringEncoding] autorelease];
}
  • 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-18T04:46:36+00:00Added an answer on May 18, 2026 at 4:46 am

    In your didReceiveResponse function you could get the total filesize like so:
    _totalFileSize = response.expectedContentLength;.

    In your didReceiveData function you can then add up to a total bytes received counter:
    _receivedDataBytes += [data length];

    Now in order to set the progressbar to the correct size you can simply do:
    MyProgressBar.progress = _receivedDataBytes / (float)_totalFileSize

    (either in the didReceiveData function or somewhere else in your code)

    Don’t forget to add the variables that hold the number of bytes to your class!

    I hope this helps..

    EDIT: Here’s how you could implement the delegates in order to update progressview

    -(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
        _totalFileSize = response.expectedContentLength;
        responseData = [[NSMutableData alloc] init];
    }
    
    
    -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
       _receivedDataBytes += [data length];
       MyProgressBar.progress = _receivedDataBytes / (float)_totalFileSize;
       [responseData appendData:data];
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Created a AlertDialog that is used to prompting the user to enter a keyword.
Created using Sphinx 0.6.5. I know Python's documentation uses reStructuredText , but it has
I created an application using UITableView . I parsing the data from URL and
Created a button, now tried to add it to the screen and im getting
Having created my first iOS app as part of my MSc project I now
Created a new App, created a new Fanpage for this App but if i
I created a Process that is targeted to the Java.exe file. The process should
I created a new project using the play console now, by default I got
Created a group of related providers using the provider pattern. Now would like to
I'm trying to integrate a NSURLConnection object with UIProgressView, so I can update the

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.