Post Pic

How to Use a Progress View

Today I will show everyone how to build a simple application (with some basic customization) that will display a progressview and a button. When the button is clicked the progressview will start.

If you need any help comment below and I will respond as soon as I can

Thanks, and enjoy

You need to a flashplayer enabled browser to view this YouTube video

Related Posts

  • How to Create UIActionsheets
  • How to Create UIAlertViews
  • Specifying UIActionsheet Actions and Buttons
  • How To Add A Basic Webview To A App
  • Cocos2d Tutorial.. Moving to a Location (Animation)


  • 5 Responses

    12.10.09

    Hi,

    this is the basic operation of the ProgressView. But the problems are comming when you try to use it for monitoring the running of a function.

    Do you have a solution for that? I have tried multi threading, but it fails. NSTimer is also not working as it is just called when the software is in idle (so out of a function called by an interaction).

    Thanks

    Endre

    12.10.09

    Hi,

    great tutorials. I am waiting for your tips and tricks too. If you do not mind I submit here my solution for the problem I have mentioned above. The main problem is that if you would like to monitor the progress of a subroutine, the iPhone GUI is not updating until you reach the end of the function. So what ever you would like to display will not be updated until then. This means that the progress bar will also not updated. You need a workaround of this by detaching a GUI update function from the current running loop.

    Here is the example:

    - (void) FunctionA {
    —– this function you plan to monitor ——

    NSString *myString=@”This message to be displayed…”;

    [NSThread detachNewThreadSelector:@selector(HandleProgressBarStatus:) toTarget:self withObject:myString];

    }

    ——- Progress Bar Update function ———
    - (void) HandleProgressBarStatus:(NSString *) Message {
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

    [MessageLabel setText:[NSString stringWithFormat:@"%@ - %0.1f%%",Message,(ProgressStatus/ProgressStatusMaxValue)*100.0]];
    [MessageLabel setTextColor:[UIColor redColor]];

    [myProgressBar setProgress:(ProgressStatus/ProgressStatusMaxValue)];
    [pool release];
    }

    ProgressStatus and ProgressStatusMaxValue are defined as class variables and values are given within the monitored function.

    In the same way you can create an AlertView or anything else. The processing of the monitored function will not block the update of the GUI.

    I hope this short example saves you some time.

    Thanks for your efforts to provide help for us!

    Regards

    Endre

    12.10.09

    Ahh… Nice, however if you are creating a game never use a code like that. because there will be issues in your game. I’ve tried it and been rejected by Apple for some “random” memory leaks!
    Good job though :)

    12.10.09

    Thanks Shayan. This video helps me to complete my assignment. Nice work. :)

    12.10.09

    your definitely welcome!

    Leave Your Response

    * Name, Email, Comment are Required
    Subscribe via RSS

    Receive the latest iPhone app tutorials and resources delivered to you. Free.

    Latest Tweet



    Follow us on Twitter

    Write for Us

    Get your name in front of the masses by writing for iPhone App Tuts. We will share a plug about you and give links to your site and Twitter page.

    Write for Us

    We need your feedback

    Would you pay a small monthly subscription for consistent iPhone tutorials?

    View Results

    Loading ... Loading ...