双层表格,两个网格

  • (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    UITableViewCell cell = [tableView dequeueReusableCellWithIdentifier:@“coll”];
    cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@“coll”];
    if (indexPath.section == 0) {
    if (indexPath.row == 0) {
    scroll = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, 150)];
    scroll.contentSize = CGSizeMake(WIDTH
    3, 150);
    scroll.pagingEnabled = YES;
    scroll.showsVerticalScrollIndicator = NO;
    scroll.showsHorizontalScrollIndicator = NO;
    scroll.bounces = NO;
    scroll.delegate = self;
    NSArray *arr = @[@“Image”,@“image1”,@“image2”];
    for (int i = 0; i<3; i++) {
    UIImageView imgV = [[UIImageView alloc]initWithFrame:CGRectMake(iWIDTH, 0, WIDTH, 150)];
    imgV.image = [UIImage imageNamed:arr[i]];
    [scroll addSubview:imgV];
    }
    [cell addSubview:scroll];
    }else{
    UICollectionViewFlowLayout *layout = [UICollectionViewFlowLayout new];
    layout.itemSize = CGSizeMake(75, 75);
    layout.minimumLineSpacing = 8;
    layout.minimumInteritemSpacing = 8;
    layout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10);
    UICollectionView *coll = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, 170) collectionViewLayout: layout];
    coll.delegate = self;
    coll.dataSource = self;
    coll.tag =1;
    coll.backgroundColor = [UIColor whiteColor];
    [coll registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@“Cell”];
    [cell addSubview:coll];
    }
    }else if (indexPath.section == 1){

      if (indexPath.row == 0) {
          cell.textLabel.text = @"旗舰店";
          cell.detailTextLabel.text = @"查看更多";
      }else{
          UICollectionViewFlowLayout *layout = [UICollectionViewFlowLayout new];
          layout.itemSize = CGSizeMake(60, 60);
          layout.minimumLineSpacing = 0;
          layout.minimumInteritemSpacing = 0;
          layout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
          UICollectionView *coll = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, 170) collectionViewLayout: layout];
          coll.delegate = self;
          coll.dataSource = self;
          coll.tag =2;
          coll.backgroundColor = [UIColor whiteColor];
          [coll registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"Cell"];
          [cell addSubview:coll];
      }
    

    }else if(indexPath.section == 2){
    if (indexPath.row == 0) {
    cell.textLabel.text = @“合作景点套票”;
    cell.detailTextLabel.text = @“查看更多”;
    }else{
    FwTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@“cell”];
    NSArray *Arr = @[@"",@“鸟巢”,@“十三陵神路”,@“十三陵定陵”];
    NSArray *RmbArr = @[@"",@“? 106.00”,@“? 25.00”,@“? 52.00”];
    NSArray *ZqArr = @[@"",@“100”,@“101”,@“102”];
    NSArray *PjArr = @[@"",@“套票108天后过期”,@“套票76天后过期”,@“套票76天后过期”];
    NSArray *ImgArr = @[@"",@“imgV1”,@“imgV2”,@“imgV3”];
    cell.Ztitle.text = Arr[indexPath.row];
    cell.Rmbtitle.text = RmbArr[indexPath.row];
    cell.Zqtitle.text = ZqArr[indexPath.row];
    cell.Pjtitle.text = PjArr[indexPath.row];
    cell.ImgV.image = [UIImage imageNamed:ImgArr[indexPath.row]];
    return cell;
    }
    }
    return cell;
    }
    //行高
    -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.section == 0) {
    if (indexPath.row == 0) {
    return 150;
    }else{
    return 170;
    }
    }else if (indexPath.section == 1){
    if (indexPath.row == 0) {
    return 44;
    }else{
    return 170;
    }
    }else{
    if (indexPath.row == 0) {
    return 44;
    }else{
    return 150;
    }
    }
    }

  • (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 0.1;
    }
    -(void)timer{

    [scroll setContentOffset:CGPointMake(WIDTH*k, 0)];
    k ++;
    if (k>2) {
    k=0;
    }

}

  • (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    if (collectionView.tag == 1) {
    return 8;
    }else{
    return 4;
    }
    }
    -(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@“Cell” forIndexPath:indexPath];
    if (collectionView.tag == 1) {
    NSArray *arr = @[@“1”,@“2”,@“3”,@“4”,@“5”,@“6”,@“7”,@“8”];
    UIImageView *imgV= [[ UIImageView alloc]initWithFrame:CGRectMake(0, 0, 75, 75)];
    imgV.image = [UIImage imageNamed:arr[indexPath.row]];
    [cell addSubview:imgV];
    }else{
    if (indexPath.row == 0) {
    UIImageView *imgV= [[ UIImageView alloc]initWithFrame:CGRectMake(0, 0, 150, 170)];
    imgV.image = [UIImage imageNamed:@“热销商品”];
    [cell addSubview:imgV];
    }else if (indexPath.row == 1){
    UIImageView *imgV= [[ UIImageView alloc]initWithFrame:CGRectMake(80, 0, 270, 80)];
    imgV.image = [UIImage imageNamed:@“热销推荐”];
    [cell addSubview:imgV];
    }else if (indexPath.row == 2){
    UIImageView *imgV= [[ UIImageView alloc]initWithFrame:CGRectMake(10, 83, 130, 85)];
    imgV.image = [UIImage imageNamed:@“十二星座”];
    [cell addSubview:imgV];
    }else if (indexPath.row == 3){
    UIImageView *imgV= [[ UIImageView alloc]initWithFrame:CGRectMake(70, 83, 130, 85)];
    imgV.image = [UIImage imageNamed:@“迪士尼系列”];
    [cell addSubview:imgV];
    }
    }
    return cell;
    }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值