-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
和sticky header(头部固定)的UICollectionView混用的时候,下拉刷新出现奇怪的动画效果 #225
Comments
好的,我抽空看看哈 |
Mj,我也遇到了这个问题,我在使用CSStickyHeaderFlowLayout之后,上下拉刷新都会出现headerView浮动的情况,我尝试着把开始刷新以及结束刷新的动画代码屏蔽之后,该现象倒是没有了,跟人感觉并不应该这么解决。不知道是CSStickyHeaderFlowLayout的问题还是怎样,麻烦你看一下吧。 |
将动画引擎由 Apple 的 Core Animation 改为 facebook 的 Pop 之后,貌似没有问题了。->_->PR:737 |
@zymxxx - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect {
NSArray *originalAttributes = [super layoutAttributesForElementsInRect:rect];
// https://github.com/CoderMJLee/MJRefresh/issues/225#issuecomment-325103061
if (self.enabled == NO) {
return originalAttributes;
}
...
}
- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds {
if (self.enabled == NO) {
return [super shouldInvalidateLayoutForBoundsChange:newBounds];
}
return YES;
}
-------------------------- Update --------------------- [self.collectionView reloadData];
// https://github.com/CoderMJLee/MJRefresh/issues/225#issuecomment-325103061
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self.collectionView.mj_header endRefreshing];
}); |
Simulator.Screen.Recording.-.iPhone.14.Pro.Max.-.2023-09-15.at.16.37.29.mp4我继承 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,是重写 |
我故意把动画的时间从MJRefreshFastAnimationDuration改成3秒,为了看得更清楚。在默认的动画时间下,不会这么明显,但是也有明显的一闪,显得很奇怪
读了一下代码,最后定位到这一段:
似乎是因为修改contentInset引起的,好像UICollectionView的隐式动画和这里的显式动画有冲突,但也不确定。可否提供一点思路,这个现象可能是由什么原因引起的?谢谢!
The text was updated successfully, but these errors were encountered: