更改uiscrollview中心的按钮颜色

时间:2016-05-16 09:11:34

标签: ios objective-c uiscrollview uibutton

我的横向null有100 UIScrollView。我想改变滚动视图UIButton处按钮的颜色?

1 个答案:

答案 0 :(得分:0)

我使用LTInfiniteScrollview从Github获取代码

-(void)updateView:(UIView *)view withProgress:(CGFloat)progress scrollDirection:(ScrollDirection)direction{


//CATransform3D transform = CATransform3DIdentity;

// scale
// CGFloat size = self.viewSize;
CGPoint center = view.center;
view.center = center;
//size = size * (1.4 - 0.3 * (fabs(progress)));
view.frame = CGRectMake(0, 0, 62 , 62);
view.layer.cornerRadius = 62 / 2;
view.center = center;
if (fabs(progress) <= 0.5)
{

    selectedBtn=(UIButton *)view;
    selectedBtn.backgroundColor=[UIColor orangeColor];
    NSString *title =[NSString stringWithFormat:@"%@",selectedBtn.titleLabel.text];
    [dynamicBtn setTitle:title forState:UIControlStateNormal];
    dynamicBtn.titleLabel.textAlignment=NSTextAlignmentCenter;
    dynamicBtn.titleLabel.numberOfLines=2;
    dynamicBtn.titleLabel.textColor=[UIColor whiteColor];

}

else
{
    selectedBtn=(UIButton *)view;
    //selectedBtn.titleLabel.text=[NSString stringWithFormat:@"%d", (int)view.tag];
    selectedBtn.backgroundColor=COLOR;

    }}

selectedBtn是scrollview中心的按钮。 如果有任何人在理解LTInfiniteScrollview时遇到问题,可以马上问我。