UICollectionView下拉使header放大模糊
生活随笔
收集整理的這篇文章主要介紹了
UICollectionView下拉使header放大模糊
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
模糊主要使用UIVisualEffectView,這只在ios8以后適用
//模糊的遮罩view @property(nonatomic,strong) UIVisualEffectView *effectView; @property(nonatomic,strong) CollectionviewLayout *layout;CollectionviewLayout *layout = [[CollectionviewLayout alloc]init]; layout.itemSize = CGSizeMake(mScreenWidth, 40); layout.headerReferenceSize = CGSizeMake(mScreenWidth, collectionViewHeaderHeight); self.layout = layout;遮罩view的設置
UIBlurEffect *blur = [UIBlurEffect effectWithStyle:(UIBlurEffectStyleLight)]; UIVisualEffectView *effectView = [[UIVisualEffectView alloc] initWithEffect:blur]; effectView.alpha = 0; self.effectView = effectView; [_collectionView addSubview:_effectView];header是UIImageView,大小為layout.headerReferenceSize
模糊是在-(void)scrollViewDidScroll:(UIScrollView *)scrollView中寫
效果為
轉載于:https://www.cnblogs.com/Apologize/p/6306578.html
總結
以上是生活随笔為你收集整理的UICollectionView下拉使header放大模糊的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2021最新 武汉互联网公司
- 下一篇: 手机app性能测试简介了解