Kirdok
Kirdok

Reputation: 1914

Progress bar with image

I am trying to make a progress bar with 2 images. One of them is grey and the other picture is green. When I click the button, I want to progress it, but it is not working.

Here is the my code (progressGreen and progressGrey are UIImageViews):

- (IBAction)nextButton:(id)sender {
  self.progressGreen.tag = rowNumber; // I am giving a number
  [self progess];
}

-(void) progess {   
  CGRect rect = self.progressGrey.frame;
  rect.size.width = (rect.size.width * (self.progressGreen.tag)) / questions.count;
  self.progressGreen.frame = rect;
}

This is my screenshot.

What is my mistake?

Upvotes: 1

Views: 448

Answers (1)

Mike Weller
Mike Weller

Reputation: 45598

Use the progressImage and trackImage properties on UIProgressView. This will be much easier than doing it manually.

Upvotes: 1

Related Questions