ios - 如何为 UI TableView 定义和拉伸(stretch) x 行的行高?

标签 ios uitableview

我正在使用一个 UITableView,它只会并且永远只会有 10 行的值。我想设置 10 行的高度,以便无论使用什么设备,它都会填充 View Controller 。

在 iPhone 4 上显示 10 行。 iPhone 5 12 排和 iPhone 7 14 排。如何设置行高,使其无论使用何种设备都只显示 10 行?

最佳答案

尝试添加:

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return self.view.bounds.size.height/10.0;
}

关于ios - 如何为 UI TableView 定义和拉伸(stretch) x 行的行高?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26435883/

相关文章:

ios - avplayer 根据速率暂停或停止通知

ios - 关于 View 和手势识别器

ios - Facebook、SnapChat 或 Gmail iOS 应用程序如何阻止 Fiddler 解密其 https 流量?

ios - 全屏查看图片时解锁方向

ios - 动态表格 View 单元格,以编程方式更改 subview 高度

iphone - 下一步按钮不显示

ios - 无法从解析服务器流式传输视频(PFFile)

ios - 如何实现类似UITableView reloadData的东西

ios - Swift:为 UITableViewCell 设置变量

ios - Swift 中只允许某些类符合协议(protocol)