UIButton下面添加滑动的线

1.循环创建完5个按钮,然后在按钮的线面添加横线。

2.在按钮的点击事件中实现横线滑动的frame的改变

3.代码如下:

[UIView animateWithDuration:.35 animations:^{

        

        CGFloat centerX = button.center.x;

        CGPoint point = CGPointMake(centerX, _selectedLine.center.y);

        _selectedLine.center = point;

        

        [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];

        

    } completion:^(BOOL finished) {

        

    }];

posted on 2015-08-19 11:07  哈利波特大  阅读(393)  评论(0编辑  收藏  举报