<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      需要在商品列表頂部添加一個banner,并且添加分類標識按鈕,要求滑動UICollectionView的時候banner滑動,而分類標識按鈕懸停(最后有圖)

      方法步驟:

      1.先創建UICollectionView

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

          layout.sectionHeadersPinToVisibleBounds = YES;//頭視圖懸浮

       metal_collection = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 40, SCREEN_WDITH, 0)       collectionViewLayout:layout];

       metal_collection.backgroundColor = [UIColor clearColor];

       metal_collection.delegate = self;

       metal_collection.dataSource = self;

       metal_collection.bounces = YES;

       metal_collection.alwaysBounceVertical = YES;//數據不夠也可以垂直滑動

       metal_collection.showsVerticalScrollIndicator = YES;

          [self.view addSubview:metal_collection];

          [metal_collection registerClass:[TMetalProductCell class] forCellWithReuseIdentifier:@"MetalCollectionCell"];

          [metal_collection registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"MetalCollectionHead"];

          [metal_collection registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:@"MetalCollectionFooter"];

      2.實現代理方法

      #pragma -------------UICollectionDataSource-------------

      -(NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView

      {

       return 2;//這里很關鍵,分兩組,把banner放在第一組的footer,把分類按鈕放在第二組的header

      }

      -(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section

      {

       if (section == 0) {

       return 0;

          }

       return metal_Muarry.count;

      }

      -(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath

      {

       TMetalProductCell * cell = [metal_collection dequeueReusableCellWithReuseIdentifier:@"MetalCollectionCell" forIndexPath:indexPath];

          cell.metalModel = metal_Muarry[indexPath.item];

       return cell;

      }

      #pragma -------------UICollectionDelegateFlowLayout-------------

      -(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section

      {

       if (section == 1) {

       return CGSizeMake(SCREEN_WDITH, 45);

          }

       return CGSizeZero;

      }

      -(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section

      {

       if (section == 0) {

       return CGSizeMake(SCREEN_WDITH, 150);

          }

       return CGSizeZero;

      }

      - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath

      {

       if (indexPath.section == 1) {

       return CGSizeMake((SCREEN_WDITH - 5)/2, (SCREEN_WDITH - 5)/2 + 83);

          }

       return CGSizeZero;

      }

      - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section

      {

       return 5;

      }

      - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section

      {

       return 5;

      }

      #pragma -------------UICollectionDelegate-------------

      -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath

      {

       TMetalProductModel * model = metal_Muarry[indexPath.item];

       TMetalProductDetailVC * transForVC =  [[TMetalProductDetailVC alloc]init];

          transForVC.metal_id = model.merchId;

          [self.navigationController pushViewController:transForVC animated:YES];

      }

      -(UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath*)indexPath

      {

       if ([kind isEqualToString:UICollectionElementKindSectionFooter] && indexPath.section == 0) {

       UICollectionReusableView * footerView = [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:@"MetalCollectionFooter" forIndexPath:indexPath];

       if (footerView.subviews.count == 0) {//加一個限制,避免無限創建新的 

       banner_Sc = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WDITH, 150)];

       banner_Sc.backgroundColor = [UIColor clearColor];

       banner_Sc.showsVerticalScrollIndicator = NO;

       banner_Sc.showsHorizontalScrollIndicator = NO;

       banner_Sc.pagingEnabled = YES;

       banner_Sc.delegate = self;

      [footerView addSubview:banner_Sc];

              }

       return footerView;

          }else if ([kind isEqualToString:UICollectionElementKindSectionHeader] && indexPath.section == 1){

       UICollectionReusableView * headView = [collectionView dequeueReusableSupplementaryViewOfKind:kind withReuseIdentifier:@"MetalCollectionHead" forIndexPath:indexPath];

       if (headView.subviews.count == 0) {//加一個限制,避免無限創建新的 

       HTScrollMenuView * menuView = [[HTScrollMenuView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WDITH, 40) withItem:@[@"工藝類",@"錢幣類",@"首飾類",@"投資類"] withDelegate:self];

      [headView addSubview:menuView];

              }

       return headView;

          }

       return nil;

      }

      posted on 2019-05-02 18:13  chennet  閱讀(2554)  評論(0)    收藏  舉報
      主站蜘蛛池模板: 一区二区中文字幕视频| 人妻系列无码专区免费 | 国产无遮挡真人免费视频| 国产香蕉九九久久精品免费| 自拍偷亚洲产在线观看| 精品人妻伦一二三区久久aaa片| 综合色一色综合久久网| 亚洲va中文字幕无码久久| 日韩精品一区二区三区蜜臀| 午夜成人无码免费看网站| 麻豆国产传媒精品视频| 成人拍拍拍无遮挡免费视频| 一二三四免费中文字幕| 男人猛戳女人30分钟视频大全| 纯肉高h啪动漫| 亚洲欧美综合精品成| 国产口爆吞精在线视频2020版 | 社旗县| 久久热这里只有精品最新| 和林格尔县| 日韩中文字幕国产精品| 国产免费无遮挡吸奶头视频| 欧美成人精品手机在线| 自拍偷亚洲产在线观看| 国产三级a三级三级| 久久精品国产精品亚洲综合| 亚洲精品免费一二三区| 国产亚洲精品第一综合另类无码无遮挡又大又爽又黄的视频 | 精品国产美女福到在线不卡| 久久亚洲精品成人av秋霞| 国产美女69视频免费观看| 一本色道久久加勒比综合| 永仁县| 国产一区二区不卡91| 在线天堂中文新版www| 国产精品夫妇激情啪发布| 中文日产乱幕九区无线码| 激情综合网激情五月我去也| 国产大尺度一区二区视频| 九九热在线观看精品视频| 亚洲AV日韩精品久久久久|