楼主:
kokuyoku (天龙狂想曲)
2015-07-07 09:49:05在文中发现你对 xib 或 storyboard 的 cell 不能动态决定高度有问题
我自己都是用 storyboard 建 cell 画面 里面都是用 Autolayout 处理子画面的位置
然后要计算各个 table view row height 时主要会用到下面这一部份
http://i.imgur.com/z0cla4a.png
其中 - setupCellData: atIndexPath: 是在 cell 里塞入资料的 method
以下是 method 部份程式码
- (void)setupCellData:(CouponListTableViewCell *)cell
atIndexPath:(NSIndexPath *)indexPath {
CouponEntity *couponData = self.couponDatas[indexPath.row];
cell.storeNameLabel.text = couponData.store_name;
....
....
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
storyboard 里画面则是长这样
http://i.imgur.com/8EXoM8V.png
比较特别的是 store name label 可以多行呈现 + “右边有一个button”
画面元件左右边有其它画面元件时的画面延展压缩又是另一个故事了