CoderMJLee / MJRefresh

An easy way to use pull-to-refresh.
MIT License
13.79k stars 3.55k forks source link

自定义UICollectionViewLayout实现头部固定后,下拉刷新出现奇怪动画效果 #1592

Open RisingSSR opened 11 months ago

RisingSSR commented 11 months ago
          https://github.com/CoderMJLee/MJRefresh/assets/88606535/4f672147-007c-41f0-bb89-659b8ad3bbda

我继承 UICollectionViewLayout 自定义了一个layout,在实现的时候出现了上述情况


      let header = MJRefreshGifHeader {
          // self.mappy.clean()
          // self.request(sno: "2021215154")
      }
      .autoChangeTransparency(true)
      .set_refresh_sports()
      .ignoredScrollView(contentInsetTop: -58)
      .link(to: collectionView)

      header.isCollectionViewAnimationBug = true
      header.endRefreshingAnimationBeginAction = {
          collectionView.collectionViewLayout.finalizeLayoutTransition()
      }

而我的自定义的layout,是重写 layoutAttributesForSupplementaryView(ofKind:at:) 实现头部固定的,请问如何处理这种动画效果

Originally posted by @RisingSSR in https://github.com/CoderMJLee/MJRefresh/issues/225#issuecomment-1720903375

wolfcon commented 11 months ago

方便给一份 Layout 用来测试吗?

或者在 MJPinHeaderCollectionViewController 中增加部分测试代码以便于调试

RisingSSR commented 11 months ago

方便给一份 Layout 用来测试吗?

或者在 MJPinHeaderCollectionViewController 中增加部分测试代码以便于调试

自定义Layout

你可以查看这个,但demo需要单独配置。

https://github.com/RisingSSR/RockSchedule/blob/main/ScheduleCollectionViewLayout.swift