Tag Archives: iPad

iOS – UIProgressView Example…

ProgressView is used to show progress of work.For example downloading,retrieving values from web service.

Create the UIProgressView by setting referencing outlets with getter and setter property.

@property (strong, nonatomic) IBOutlet UIProgressView *progressObject;

@synthesize progressObject;

Create a button with method named,

- (IBAction)startProgress:(id)sender;

Implement the methods in the .m file,

static float progress = 0.0f;

-(void)showWithProgress

{

progress = 0.0f;

progressObject.progress  = progress;

if(progressObject.progress<1)

[self performSelector:@selector(increaseProgress) withObject:nil afterDelay:0.3];

}

-(void)increaseProgress {

progress+=0.1f;

progressObject.progress = progress;

if(progress < 1.0f)

[self performSelector:@selector(increaseProgress) withObject:nil afterDelay:0.3];

}

Now just call these methods like this,

- (IBAction)startProgress:(id)sender

{

[self showWithProgress];

}

OUTPUT:

progressview

PROPERTIES:

progressImage

An image to use for the portion of the progress bar that is filled.

@property(nonatomic, retain) UIImage *progressImage
  • Available in iOS 5.0 and later.

ProgressTintColor

The color shown for the portion of the progress bar that is filled.

@property(nonatomic, retain) UIColor *progressTintColor
  • Available in iOS 5.0 and later.

ProgressViewStyle

The current graphical style of the receiver.

@property(nonatomic) UIProgressViewStyle progressViewStyle
  • Available in iOS 2.0 and later.

TrackImage

An image to use for the portion of the track that is not filled.

@property(nonatomic, retain) UIImage *trackImage

TrackTintColor

The color shown for the portion of the progress bar that is not filled.

@property(nonatomic, retain) UIColor *trackTintColor
  • Available in iOS 5.0 and later.
Advertisements