鍍金池/ 問答/C  iOS  網(wǎng)絡(luò)安全/ iOS下拉刷新的背景色問題,漏一截

iOS下拉刷新的背景色問題,漏一截

UICollectionView下拉刷新,上面一個背景色,下面一個背景色。
一般可以在root View上繪制不同區(qū)塊的顏色,設(shè)置Customize 的背景色。
也可以 在rootView 上, CollectionView 下 ,加一層帶顏色的View.
CollectionView 拉過(邊界)了,就不太好啦。 見底圖。
我覺得,可以加一層帶顏色的View, 通過 KVO , 或者 在 代理方法 - scrollViewDidScroll 中,動態(tài)調(diào)整帶顏色的 View 的 Y值 ,和Height.
有點Low.
問下,有沒有系統(tǒng)API 級別(UIScrollView)的解決方案。
求推薦更好的解決方案。

圖片描述

附: UICollectionView 的初始化/ 布局代碼

 - (UICollectionView *)mineCollectionView{
if(!_mineCollectionView){
UICollectionViewFlowLayout * defaultLayout = [[UICollectionViewFlowLayout alloc] init];
        defaultLayout.minimumLineSpacing = 0;
        defaultLayout.minimumInteritemSpacing = 0;
         _mineCollectionView = [[UICollectionView alloc] initWithFrame: CGRectZero collectionViewLayout: defaultLayout];
         ····
     }
     return _mineCollectionView;
 }
         
    
    

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
   
    [self.view addSubview: self.mineCollectionView];
    [self.mineCollectionView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.mas_topLayoutGuide);
        make.left.equalTo(self.view);
        make.right.equalTo(self.view);
        make.bottom.equalTo(self.mas_bottomLayoutGuide);
    }]; }


回答
編輯回答
我甘愿

在tableView的頂部添加一個藍色背景的UIIView

UIView *bgView = [[UIView alloc] initWithFrame:CGRectOffset(_tableView.bounds, 0, -_tableView.bounds.size.height)];
bgView.backgroundColor = [UIColor blueColor];
[_tableView insertSubview:bgView atIndex:0];

圖片描述

2018年7月22日 16:30
編輯回答
尐潴豬

感覺要點還是在, UICollectionDecorationView,
難道要decorationView 動態(tài)布局

2017年3月19日 02:46