problem with elasticMaximumHeightAtTop when I need a negative progress
jobsLee-lcj opened this issue · 0 comments
jobsLee-lcj commented
Firstly, thank you for this great work, it helps me a lot.We know that elasticMaximumHeightAtTop
determine whether can stretch to larger sizes than it's maximumBarHeight
,so that, a negative progress.
As code in - (void)setProgress:(CGFloat)progress;
- (void)setProgress:(CGFloat)progress
{
_progress = fmin(progress, 1.0);
//if isElasticMaximumHeightAtTop is YES, a negative progress will not be changed to 0.0.
if((self.behaviorDefiner && !self.behaviorDefiner.isElasticMaximumHeightAtTop) || !self.behaviorDefiner)
{
_progress = fmax(_progress, 0.0);
}
}
However,code in layoutSubviews did the opposite thing.
- (void)layoutSubviews
{
[super layoutSubviews];
// Update height
CGRect barFrame = self.frame;
barFrame.size.height = [self interpolateFromValue:self.maximumBarHeight toValue:self.minimumBarHeight withProgress:self.progress];
self.frame = barFrame;
//if isElasticMaximumHeightAtTop is YES, a negative progress will be changed to 0.0
if(self.behaviorDefiner && self.behaviorDefiner.isElasticMaximumHeightAtTop)
{
self.progress = fmax(self.progress, 0.0);
}
......
}
the result is a negative progress will be changed to 0.0 when layoutSubviews.I delete the below code in layoutSubviews for my goal.
if(self.behaviorDefiner && self.behaviorDefiner.isElasticMaximumHeightAtTop)
{
self.progress = fmax(self.progress, 0.0);
}