This commit is contained in:
2025-11-13 16:23:46 +08:00
parent f406416698
commit a61b5fa2fd
6 changed files with 276 additions and 18 deletions

View File

@@ -143,7 +143,7 @@ static const CGFloat JXheightForHeaderInSection = 50;
self.naviBGView = [[UIView alloc] init];
self.naviBGView.alpha = 0;
self.naviBGView.backgroundColor = [UIColor whiteColor];
self.naviBGView.backgroundColor = [UIColor clearColor];
self.naviBGView.frame = CGRectMake(0, 0, KB_SCREEN_WIDTH, KB_NAV_TOTAL_HEIGHT);
[self.view addSubview:self.naviBGView];
UILabel *naviTitleLabel = [[UILabel alloc] init];
@@ -219,15 +219,15 @@ static const CGFloat JXheightForHeaderInSection = 50;
- (void)pagerView:(JXPagerView *)pagerView mainTableViewDidScroll:(UIScrollView *)scrollView {
// -
// -
CGFloat headerH = (CGFloat)[self tableHeaderViewHeightInPagerView:self.pagerView];
CGFloat thresholdDistance = MAX(0.0, headerH - self.pagerView.pinSectionHeaderVerticalOffset);
CGFloat percent = (thresholdDistance > 0 ? scrollView.contentOffset.y/thresholdDistance : 1);
percent = MAX(0, MIN(1, percent));
self.naviBGView.alpha = percent;
//
// -
// alpha=0() alpha=1
BOOL shouldWhite = (thresholdDistance > 0.0 && scrollView.contentOffset.y >= (thresholdDistance - 0.5));
self.naviBGView.alpha = shouldWhite ? 1.0 : 0.0;
//
if (shouldWhite != self.categoryIsWhite) {
self.categoryIsWhite = shouldWhite;
UIColor *bg = shouldWhite ? [UIColor whiteColor] : [UIColor clearColor];