【问题标题】:Resize of the main view in interface builder [duplicate]在界面构建器中调整主视图的大小[重复]
【发布时间】:2016-02-13 10:19:14
【问题描述】:

我尝试按照教程进行操作,但这是相当老的教程,当您使用应用程序的视图运行应用程序时会出现一些问题。

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

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 (或摆脱黑色区域)?

【问题讨论】:

  • 请出示您的代码
  • @OrkhanAlizade,完成!
  • 你到底想做什么?
  • @OrkhanAlizade 去除黑色区域

标签: ios xcode swift


【解决方案1】:

Images.xcassets > LaunchImage 中为您想要支持的分辨率添加适当的启动图像。例如,对于 iPhone 5 纵向,分辨率为 640x1136。

这是在 Xcode 中查找的界面截图:

【讨论】:

  • 这正是我所需要的。谢谢!
【解决方案2】:

要解决此问题,请按照以下步骤操作:

  1. 导航到项目设置

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

  3. 在出现的弹出窗口中选择“迁移”。

这应该可以解决问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-12-21
    • 1970-01-01
    • 2012-10-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-29
    相关资源
    最近更新 更多