zoukankan      html  css  js  c++  java
  • 第十三篇、OC_UICollectionView的基本配置

    - (UICollectionView *) categoryCollectionView
    {
        if (! _categoryCollectionView) {
            
            // 创建布局
            UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init];
            layout.itemSize = CGSizeMake(KItemWidth,KItemHeight);
            layout.minimumInteritemSpacing = KSpace;
            layout.minimumLineSpacing = KSpace;
            layout.headerReferenceSize = CGSizeMake(KScreentW,KProductHeaderCellH);
            
            _categoryCollectionView = [[UICollectionView alloc]initWithFrame:self.view.bounds collectionViewLayout:layout];
            _categoryCollectionView.dataSource = self;
            _categoryCollectionView.delegate = self;
            _categoryCollectionView.backgroundColor = [UIColor colorWithRed:234.0/255 green:234.0/255 blue:234.0/255 alpha:1];
            
            // 注册
            [_categoryCollectionView registerNib:[UINib nibWithNibName:@"GFBCategoryCollectionViewCell" bundle:nil] forCellWithReuseIdentifier:KProductCell];
            [_categoryCollectionView registerNib:[UINib nibWithNibName:@"GFBCategoryCollectionReusableView" bundle:nil] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:KProductHeaderCell];
            
            // 设置内边距,添加轮播图
            _categoryCollectionView.contentInset = UIEdgeInsetsMake(KBanerH, 0, 0, 0);
    
        }
        return _categoryCollectionView;
    }
  • 相关阅读:
    CAST()类型转换函数
    CLR LOH的危险
    保持积极的态度,态度决定一切!
    as 操作符和强行转换的区别
    查内存覆盖从以前的帖子里总结的
    CLR中的范型为什么不支持很多操作符?
    如何做一个好的Team Leader?
    Dispose Pattern总结
    慎用Reflection
    CLR Enum类型内幕
  • 原文地址:https://www.cnblogs.com/HJQ2016/p/6102538.html
Copyright © 2011-2022 走看看