-(void)scrollViewDidScroll:(UIScrollView*)scrollView
{
if(scrollView ==scroll) {
CGFloatx = scrollView.contentOffset.x;
self.selectIndex= x /SCREEN_WIDTH;
[self changeButtonTextColor];
[self changeLinePlaceWithIndex:self.selectIndex];
return;
}
}
//改变line位置
- (void)changeLinePlaceWithIndex:(NSInteger)index
{
[UIView animateWithDuration:0.5 animations:^{
CGRectframe =self->line.frame;
frame.origin.x=SCREEN_WIDTH/2* index +SCREEN_WIDTH/4-17*SCREENRATE;
self->line.frame= frame;
}];
}
网友评论