快速创建一个collectionView

2019-05-06  本文已影响0人  ljzza

UICollectionViewFlowLayout *flowLayOut = [[UICollectionViewFlowLayout alloc] init];
_collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 29, DEVICE_SCREEN_WIDTH, DEVICE_SCREEN_HEIGHT-DEVICE_STATUS_BAR_HEIGHT-DEVICE_NAVIGATION_BAR_HEIGHT - 29) collectionViewLayout:flowLayOut];
_collectionView.delegate = self;
_collectionView.dataSource = self;
_collectionView.backgroundColor = COLOR_HEX(0xf7f7f7, 1.0);
[self.view addSubview:_collectionView];
[_collectionView registerNib:[UINib nibWithNibName:@"InstallUnitCollectionViewCell" bundle:[NSBundle mainBundle]] forCellWithReuseIdentifier:@"InstallUnitCollectionViewCell"];

pragma mark ---- UICollectionViewDataSource

}

pragma mark ---- UICollectionViewDelegateFlowLayout

//- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section
//{
// //上下距离
// return 10;
//
//}

上一篇 下一篇

猜你喜欢

热点阅读