您的位置:首页 > 产品设计 > UI/UE

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

2015-06-12 16:47 459 查看

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: