I need UIProgressView as part of UITableView cell for one iOS 7 application. I have added UIProgressView from code on the right side of cell like this:
_progressBar = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
_progressBar.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_progressBar];
[self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:_progressBar attribute:NSLayoutAttributeCenterY relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:0.0]];
[self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:_progressBar attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-10.0]];
[_progressBar addConstraint:[NSLayoutConstraint constraintWithItem:_progressBar attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:60.0]];
[_progressBar addConstraint:[NSLayoutConstraint constraintWithItem:_progressBar attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:12.0]];
However, displaying UIProgressView is a bit strange. When progress is zero, UIProgressView object looks like this:
When I set progress value to 0.5, UIProgressView becomes rectangle on the left and remains rounded rectangle on the right:
And when I set progress to 0.98, looks like this:
Any idea how to fill UIProgressView by simply setting progress value and that rounded rectangle (or rectangle) form of element are kept the entire time? Or is this impossible without adding custom graphics or overriding UIProgressView?
Many thanks in advance and best regards.