iOS注册collcetionViewFlowLayout

  self.arr = [[NSMutableArray alloc] init];

  for (int i = 0; i < 9; i++) {

    [self.arr addObject:[UIImage imageNamed:[[NSString alloc] initWithFormat:@"%d",i + 1]]];

  }

  UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];

  [flowLayout setScrollDirection:UICollectionViewScrollDirectionVertical];

  self.collectionView = [[UICollectionView alloc] initWithFrame:[[UIScreen mainScreen] bounds] collectionViewLayout:flowLayout];

  [self.collectionView registerClass:[CollectionViewCell class] forCellWithReuseIdentifier:@"MyCollectionCell"];

  

  self.collectionView.backgroundColor = [UIColor whiteColor];

  [self.view addSubview:self.collectionView];

 

  self.collectionView.dataSource = self;

  self.collectionView.delegate = self;

  [self.collectionView registerClass:[CollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"Header"];

 

 

 【微分享】:为明天做准备的最好方法就是集中你所有智慧,所有的热忱,把今天的工作做得尽善尽美,这就是你能应付未来的唯一方法!

posted @ 2016-03-10 09:03  super1250  阅读(173)  评论(0编辑  收藏  举报