美文网首页
iOS collectionview中headerView或者f

iOS collectionview中headerView或者f

作者: lmao94 | 来源:发表于2019-03-12 16:10 被阅读0次

iOS11之后才碰到的问题,下面是一种解决办法

- (void)collectionView:(UICollectionView *)collectionView willDisplaySupplementaryView:(UICollectionReusableView *)view forElementKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath {
    view.layer.zPosition = 0.0;
}
多个地方出现这个问题,可以自定义一个layer,重写它的 - (CGFloat)zPosition方法,返回0.0
然后再reuseView中的 + (Class)layerClass 返回自定义的layer类型,即用自定义layer替换掉原来的layer

相关文章

网友评论

      本文标题:iOS collectionview中headerView或者f

      本文链接:https://www.haomeiwen.com/subject/rrjnpqtx.html