- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
问题的可见性:http://i.imgur.com/TastPR9.gifv
func animateHeaderResize(height: CGFloat) {
let layout = self.collectionView?.collectionViewLayout as! UICollectionViewFlowLayout;
layout.headerReferenceSize = CGSize(width: UIScreen.main.bounds.width, height: height);
UIView.animate(withDuration: 1, delay: 0, options: .curveEaseOut, animations: {
self.collectionView?.layoutIfNeeded();
}) { (finished) in
//self.loadPosts();
}
}
我正在尝试通过 UICollectionViewLayout 来动画显示 UICollectionView header 大小的变化。生成的动画有奇怪的闪光和拉伸(stretch),这可能是在某处触发的交叉溶解过渡。我尝试了设置 Collection View 布局的多种变体,包括 setCollectionViewLayout(layout:animated:) 和实现 collectionView(_ collectionView:layout:referenceSizeForHeaderInSectionsection:) 但所有结果都是相同的动画。
我注意到,更改 Collection View 的项目大小时会发生相同的闪烁。也许这是我可以修改的一些默认行为?我必须继承 UICollectionViewFlowLayout 的子类吗?我尝试过搜索,但找不到解决方案,希望朝正确的方向迈出一步。
最佳答案
这最终对我有用:
func animateHeaderResize(height: CGFloat) {
self.collectionView?.performBatchUpdates({
let layout = self.collectionView?.collectionViewLayout as! UICollectionViewFlowLayout;
layout.headerReferenceSize = CGSize(width: UIScreen.main.bounds.width, height: height);
}, completion: { (fin) in
self.loadPosts();
});
}
关于ios - Animate UICollectionViewLayout header 大小会导致不必要的 Flash 交叉溶解,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43621051/
jQuery attributeContainsPrefix [name^="value"] 对比 attributeStartsWith [name|="value"] 实际区别是什么? 最佳答案
在1.1部分在RFC 6749中,有四种角色:资源拥有者、资源服务器、客户端和授权服务器。 如果客户端和资源所有者是同一实体,OAuth 是否变得多余或不必要? 例如,我有一个封闭的 API 和一个面
我有一段代码,其中有一个带有保护子句的 raise 语句: def validate_index index # Change to SizeError raise ArgumentError
我看到了这篇文章( JPA Entity Lifecycle Events vs database trigger ),但它并没有像我在这里那样明确地询问: 当我插入 PK 值为 (null) 的行时
所以,我有一段代码看起来像 if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2){ // Do something }
我是一名优秀的程序员,十分优秀!