【问题标题】:Wrong width of custom section header form xib自定义节标题表单xib的宽度错误
【发布时间】:2015-05-26 08:36:54
【问题描述】:

我无法让视图的宽度适应不同屏幕尺寸的表格视图的尺寸

这是我在 viewDidLoad() 上的代码

    view.tableView.registerNib(UINib(nibName: "Header", bundle: NSBundle.mainBundle()), forHeaderFooterViewReuseIdentifier: "Header")

在 Table View Delegate 上:

  func tableView(tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
    var cell = tableView.dequeueReusableHeaderFooterViewWithIdentifier("Header") as! Header
    // etc 
 }

请记住,我不想将它放在情节提要中,并且我正在使用自动布局。

有什么建议吗?

【问题讨论】:

    标签: ios iphone uitableview autolayout xib


    【解决方案1】:

    我的 xib 由一个 UITableViewCell 组成。我用 UIView 替换它,它解决了我的问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多