A static UITabelView solution ---- CTStaticTableView, ios static tableview
CTStaticTableView
This is a method of encapsulating static TableView with code.
You can use xib to initialize CTStaticTableView, or use the code:
self.tableView = [[CTStaticTableView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)]; [self.view addSubview:self.tableView];
Then you can synthesize your static table view cell.
Two parameters are required: one is the TableViewCell object and the other is its height.
CTStaticTableViewCell *fristStaticCell = [CTStaticTableViewCell staticTableViewCellWithCell:[DemoTableViewFristCell fristCell] height:50]; CTStaticTableViewCell *secendStaticCell = [CTStaticTableViewCell staticTableViewCellWithCell:[DemoTableViewSecendCell secendCell] height:80];
Join up
[Self. tableView showStaticCells: @ [fristStaticCell, secendStaticCell]; // or [self. tableView showStaticCells: @ [fristStaticCell, secendStaticCell] withDidSelectRowDelegate: self]; // or [self. tableView showStaticCells: @ [fristStaticCell, secendStaticCell] withDidSelectRowBlock: ^ (NSIndexPath * indexPath) {NSLog (@ "taptaptaptap");}];
No. Check the demo code.
Https://github.com/chentoo/CTStaticTableView