天天看點

表格視圖 - 使用代碼自定義行高度

1. 實作UITableViewDelegate協定

@interface ViewController () <UITableViewDelegate>

2. 将表格視圖的代理屬性指向其父容器視圖

self.myTableView.delegate = self;

3. 實作協定對應的方法

tableView:heightForRowAtIndexPath:

完整代碼(ViewController.m):

繼續閱讀