相关疑难解决方法(0)

在UITableView中使用自动布局来获取动态单元格布局和可变行高

如何UITableViewCell在表格视图中使用s 内的自动布局,让每个单元格的内容和子视图确定行高(本身/自动),同时保持平滑的滚动性能?

row-height uitableview ios autolayout nsautolayout

1477
推荐指数
18
解决办法
55万
查看次数

通过单元格内textView的内容更改单元格高度

我有一个表格视图,todoTableView其中包含由用户创建的单元格.每个单元格都有文本视图.我想通过文本视图的内容更改单元格的高度.这是我试过的:

func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell: TableViewCell = tableView.dequeueReusableCellWithIdentifier("cell", forIndexPath:indexPath) as! TableViewCell
        cell.bounds.size.height = cell.textView.bounds.size.height

        return cell
    }
Run Code Online (Sandbox Code Playgroud)

iphone xcode uitableview ios swift

8
推荐指数
1
解决办法
9207
查看次数

标签 统计

ios ×2

uitableview ×2

autolayout ×1

iphone ×1

nsautolayout ×1

row-height ×1

swift ×1

xcode ×1