作者kokuyoku (天龙狂想曲)
标题Re: [心得] 开发了一个月的 iOS 小作品
时间Tue Jul 7 09:49:05 2015
在文中发现你对 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」
画面元件左右边有其它画面元件时的画面延展压缩又是另一个故事了
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 220.129.53.228
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/MacDev/M.1436233748.A.AE6.html
※ 编辑: kokuyoku (220.129.53.228), 07/07/2015 09:50:31