How to make progress view in iphone?

Leave a Comment
This is the complete demo with source code of progress view in iphone using programming. This is the simple way to add progress view in iphone. Simple code snippets are here.

devangViewController .h header file

#import <UIKit/UIKit.h>
@interface devangViewController : UIViewController
- (IBAction)download:(id)sender;
@property (weak, nonatomic) IBOutlet UIProgressView *progress;
@end
devangViewController .m


#import "devangViewController.h"
@interface devangViewController ()
@end
@implementation devangViewController
@synthesize progress;
- (void)viewDidLoad
{
    [super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)download:(id)sender {
   
    NSNumber *counterPercentage;
    for (int pageDownload = 1; pageDownload < 10000000; pageDownload++ ) {
        counterPercentage = [[NSNumber alloc] initWithFloat: (float)pageDownload / (float)((float)10000000)];
        [progress setProgress: [counterPercentage floatValue]];
        [progress performSelectorOnMainThread:@selector(setNeedsDisplay) withObject:nil waitUntilDone:YES];
    }
}
@end
i hope you will be clear with this demo.


Output



Download Source Code



0 comments:

Post a Comment