viewForSupplementaryElementOfKind不执行的解决方法

viewForSupplementaryElementOfKind不执⾏的解决⽅法
为了降低代码耦合性,通常⾃定义UICollectionViewFlowLayout。今天在⾃定义UICollectionViewFlowLayout时,想设置UICollectionView 的footerView,但viewForSupplementaryElementOfKind不执⾏,改成系统的UICollectionViewFlowLayout就可以。世界末日几号
⾃定义UICollectionViewFlowLayout添加header 和footer的解决⽅法:
- (nullableNSArray<__kindofUICollectionViewLayoutAttributes*> *)layoutAttributesForElementsInRect:(CGRect)rect{ NSMutableArray*attributes = [[superlayoutAttributesForElementsInRect:rect]mutableCopy];
for(NSIntegeri =0; i <_numberOfCells; i++) {
尘肺病防治条例NSIndexPath*indexPath = [NSIndexPathindexPathForItem:iinSection:0];
UICollectionViewLayoutAttributes*attribute = [selflayoutAttributesForItemAtIndexPath:indexPath];
乌氏粘度计原理
[attributesaddObject:attribute];
}
bbc
for(UICollectionViewLayoutAttributes*attrsinattributes) {
if([attrsrepresentedElementKind] ==UICollectionElementKindSectionFooter) {
CGRectheaderRect = [attrsframe];
headerRect.size.height=100;
headerRect.size.width=SCREEN_SIZE.width;
[attrssetFrame:headerRect];
break;
}2013北京中考物理
王一伦}
returnattributes;
}

本文发布于:2024-09-21 12:19:50,感谢您对本站的认可!

本文链接:https://www.17tex.com/xueshu/649227.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:降低   防治   物理   系统
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议