search

Home  >  Q&A  >  body text

objective-c - iOS凤凰新闻这种控件跟随滑动的效果是怎么做出来的?

文字颜色渐变我已经做出来了,在- (void)scrollViewDidScroll:(UIScrollView *)scrollView中通过偏移量计算出两个scale,一个递增一个递减,从0~1和从1~0,通过这个scale来动态修改RGB颜色。

这个下划线,在我滚动下面的新闻表格的时候,它会动态的改变frame,偏移的x和宽度。
目前我只是在- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView中,在拖动完成后,加了个动画。

我想做出凤凰新闻这样的效果,下划线可以实时跟随改变,不知各位能提供一下思路吗?折腾好久了T_T

巴扎黑巴扎黑2889 days ago554

reply all(3)I'll reply

  • 黄舟

    黄舟2017-04-17 17:53:33

    A demo I wrote to simulate Phoenix News after reading your question this afternoon.
    Article: Simulating Phoenix News | More complex label animation - Swift implements side sliding and switching of multiple TableViews
    Project source code: github repository: Simulating Phoenix News homepage

    reply
    0
  • 大家讲道理

    大家讲道理2017-04-17 17:53:33

    You can use pop, or implement it yourself

    reply
    0
  • 阿神

    阿神2017-04-17 17:53:33

    Okay, I solved it myself.
    It’s actually a math problem. . .

    The specific demo is on github. If you need it, you can take a look at it in the DDNewsViewController.m文件的scrollViewDidScrollmethod.
    https://github.com/iDvel/DDNews

    reply
    0
  • Cancelreply