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

Update HomeViewController.m #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,23 @@ - (void)setupTopMenu

#pragma mark - UIScrollViewDelegate

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
// - (void)scrollViewDidScroll:(UIScrollView *)scrollView
// {
// CGFloat page = scrollView.contentOffset.x / ALinScreenWidth;
// CGFloat offsetX = scrollView.contentOffset.x / ALinScreenWidth * (self.selectedView.width * 0.5 - Home_Seleted_Item_W * 0.5 - 15);
// self.selectedView.underLine.x = 15 + offsetX;
// if (page == 1 ) {
// self.selectedView.underLine.x = offsetX + 10;
// }else if (page > 1){
// self.selectedView.underLine.x = offsetX + 5;
// }
// self.selectedView.selectedType = (int)(page + 0.5);
// }

// 当手动滑动的时候触发 scrollView的scrollViewDidEndDecelerating 而scrollViewDidScroll方法,不然会发现指示器的下划线滑动错误
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
// 滑动 scrollView 时顶部指示器也滑动
CGFloat page = scrollView.contentOffset.x / ALinScreenWidth;
CGFloat offsetX = scrollView.contentOffset.x / ALinScreenWidth * (self.selectedView.width * 0.5 - Home_Seleted_Item_W * 0.5 - 15);
self.selectedView.underLine.x = 15 + offsetX;
Expand Down