一个静态UITabelView的解决方案----CTStaticTableView

CTStaticTableView

这是一个用代码封装静态TableView的方式。

你可以用xib初始化CTStaticTableView,也可以用代码:

    self.tableView = [[CTStaticTableView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];
    [self.view addSubview:self.tableView];

然后可以合成你的static table view cell
需要两个参数:一个是TableViewCell对象,一个是他的高度。

    CTStaticTableViewCell *fristStaticCell = [CTStaticTableViewCell staticTableViewCellWithCell:[DemoTableViewFristCell fristCell] height:50];
    CTStaticTableViewCell *secendStaticCell = [CTStaticTableViewCell staticTableViewCellWithCell:[DemoTableViewSecendCell secendCell] height:80];

拼起来吧

    [self.tableView showStaticCells:@[fristStaticCell, secendStaticCell]];
    //或者
    [self.tableView showStaticCells:@[fristStaticCell, secendStaticCell] withDidSelectRowDelegate:self];
    //或者
    [self.tableView showStaticCells:@[fristStaticCell, secendStaticCell] withDidSelectRowBlock:^(NSIndexPath *indexPath) {
        NSLog(@"taptaptap");
    }];

没了,请看demo代码。

https://github.com/chentoo/CTStaticTableView

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值