Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不能实现渐变色啊。 #49

Closed
MichaelHuyp opened this issue Sep 30, 2016 · 2 comments
Closed

不能实现渐变色啊。 #49

MichaelHuyp opened this issue Sep 30, 2016 · 2 comments

Comments

@MichaelHuyp
Copy link

我有一个方法会频繁调用

- (void)handlePopGesture:(UIPanGestureRecognizer *)popGesture
{
    // 计算用户手指划了多远
    CGFloat progress = [popGesture translationInView:self.view].x / (self.view.bounds.size.width * 1.0);
    progress = MIN(1.0, MAX(0.0, progress));
    YPLog(@"%f",progress);

    CGFloat r = _endR - _startR;
    CGFloat g = _endG - _startG;
    CGFloat b = _endB - _startB;

    UIColor *endColor = [UIColor colorWithRed:_startR + r * progress green:_startG + g * progress blue:_startB + b * progress alpha:1.0f];

    [self.navigationController.navigationBar lt_setBackgroundColor:endColor];
}

随着进度改变Bar的背景颜色。。 发现不好用 颜色不会变

@MichaelHuyp
Copy link
Author

你的Demo里面提供了 颜色渐变是alpha形式的渐变。 那么由红色到蓝色 的渐变 就失效了

@MichaelHuyp
Copy link
Author

哦哦 好了 想研究下最新支付宝的导航条渐变色是怎么弄的。。 Pop的时候改变颜色原来需要用上级控制器才行

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant