【问题标题】:UITableViewController and UIViewController in Xcode Swift 4Xcode Swift 4 中的 UITableViewController 和 UIViewController
【发布时间】:2018-04-19 13:09:11
【问题描述】:

在 iOs 应用程序中,我从继承到 UITableViewController 的 appdelegate 调用 RootViewController 类,

import Foundation
import UIKit


class RootViewController : UITableViewController
{


    // MARK: - View lifecycle
    override func loadView()
    {
        super.loadView()
        self.title = " Sample App"

    }

}

如果我运行此代码,我会在 ios 应用程序中得到一个空的 tableview,但如果我将其更改为 UIViewController,而后者又连接到情节提要,我会得到一个黑屏。我尝试在互联网上检查,但没有运气。

【问题讨论】:

  • 好的,但是你的问题是什么?
  • 我需要显示链接到视图控制器的情节提要,但目前我得到一个黑屏。@Wladek Surala

标签: ios xcode uitableview uiviewcontroller swift4


【解决方案1】:

如果你把它改成UIViewController,你就没有UIView-Object,比如UITableViewController的TableView。我认为您必须手动将UITableView-Object 添加到您的UIViewController

【讨论】:

  • 你想要什么@dinesh?你想加载 TableView 还是 UIView?一旦您将类从 UITableViewControllers 更改为 UIViewController,您还需要更改视图并连接,反之亦然。
  • @Rishi Chaurasia 我想加载一个 Storyboard ,它连接到 UIViewController 即) RootViewController 。默认情况下,salesforce 应用程序带有 UITabelViewController ,我需要显示我的故事板而不是那个。
猜你喜欢
  • 2017-02-03
  • 1970-01-01
  • 2019-08-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-08-14
  • 1970-01-01
相关资源
最近更新 更多