Ios 在interface builder中调整主视图的大小

Ios 在interface builder中调整主视图的大小,ios,xcode,swift,Ios,Xcode,Swift,我试着按照教程来做,但这是一个很老的教程,这里有一些问题,当你用应用程序的视图运行应用程序时 没有图像,我重建了约束,但没有任何更改 ViewController的代码: class MasterViewController: UIViewController { @IBOutlet var tableView: UITableView! @IBOutlet var searchBar: UISearchBar! override func prepareForSegue(se

我试着按照教程来做,但这是一个很老的教程,这里有一些问题,当你用应用程序的视图运行应用程序时

没有图像,我重建了约束,但没有任何更改

ViewController的代码:

class MasterViewController: UIViewController {

  @IBOutlet var tableView: UITableView!
  @IBOutlet var searchBar: UISearchBar!

  override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
    if segue.identifier == "showDetail" {
    }
  }

  override func viewWillAppear(animated: Bool) {
    super.viewWillAppear(animated)
    if let selectedIndexPath = self.tableView.indexPathForSelectedRow {
      self.tableView.deselectRowAtIndexPath(selectedIndexPath, animated: true)
    }
  }
}

extension MasterViewController: UITableViewDataSource, UITableViewDelegate {

  func numberOfSectionsInTableView(tableView: UITableView) -> Int {
    return 1
  }

  func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return 0
  }

  func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)
    return cell
  }

  func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool {
    return true
  }

  func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
  }

}

extension MasterViewController: UISearchBarDelegate {

  func searchBarSearchButtonClicked(searchBar: UISearchBar) {
  }

}

我如何调整它的大小,而不仅仅是针对iPhone 4(或去除黑色区域)?

images.xcsets>LaunchImage中添加合适的启动图像,以获得您想要支持的分辨率。例如,对于iPhone5人像,分辨率为640x1136

下面是要在Xcode中查找的界面的屏幕截图:


要解决此问题,请执行以下步骤:

  • 导航到项目设置

  • 在“应用程序图标和启动图像”下,单击“使用资产目录”

  • 在出现的弹出窗口中选择“迁移”


  • 这应该可以解决问题。

    显示您的代码,please@OrkhanAlizade好了!你到底想做什么?@OrkhanAlizade清除黑色区域这正是我需要的。非常感谢。