Xcode - UITableView之后的空白

时间:2015-11-24 13:49:17

标签: xcode uitableview

根据他们正在查看的显示器,让UITV单元格调整大小的最佳/正确方法是什么?基本上,无论使用何种设备,我都希望在屏幕上显示相同数量的行。这是在代码中完成还是我在故事板中遗漏了什么?

请参阅下面的示例(这是我在故事板中看到的): enter image description here

这是我在iPhone 6模拟器的屏幕底部看到的: enter image description here 这就是我在iPhone 4s模拟器屏幕底部看到的内容: enter image description here

我对Xcode很陌生,所以欣赏这可能是一个记录良好的问题...但我现在已经有一段时间了,我现在需要一个很少的帮助 - 所以任何帮助表示赞赏。

提前致谢。

1 个答案:

答案 0 :(得分:1)

您必须在std::vector<bool> boolVec( 6, true ); 子类中处理此问题,无法在故事板中执行您想要执行的操作。

假设如下:

  1. 表格视图以纵向模式修复
  2. 表格视图只有一个部分
  3. 将此方法添加到UITableViewController子类将根据表视图的高度返回动态高度:

    (SWIFT)

    UITableViewController

    (目标C)

    func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat{
         let numCells = self.tableView(self.tableView, numberOfRowsInSection:0)
         let cellHeight = self.tableView.frame.size.height / CGFloat(numCells)
         return cellHeight
    }
    
相关问题