Xcode Storyboard - 在哪里设置 UITableViewCell 高度 [英] Xcode Storyboard - Where to set UITableViewCell height

查看:37
本文介绍了Xcode Storyboard - 在哪里设置 UITableViewCell 高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Xcode 7,我正在尝试在情节提要中设置 UITableViewCell 的高度,以便为不同的设备(例如,普通和紧凑型 x 常规)设置不同的单元格高度.

I am using Xcode 7 and I am trying to set the height of a UITableViewCell in the storyboard settings to have a different cell height for different devices (eg. normal and compact x regular).

我找不到这些设置的位置.这只能通过以编程方式进行吗?

I cannot find a place for these settings. Is this only possible by doing it programmatically?

推荐答案

点击 Table View 然后点击 Size Inspector

并在此处调整您的单元格行高 -

tableView.estimatedRowHeight = 100.0 // Adjust Primary table height
tableView.rowHeight = UITableViewAutomaticDimension //This line adjust cell height according to containts


Swift 4 或更高版本

  • 您需要将 UITableViewAutomaticDimension 更改为 UITableView.automaticDimension
  • tableView.estimatedRowHeight = 100.0 // Adjust Primary table height
    tableView.rowHeight = UITableView.automaticDimension
    

    这篇关于Xcode Storyboard - 在哪里设置 UITableViewCell 高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆