【问题标题】:display the data in UIViewController在 UIViewController 中显示数据
【发布时间】:2018-04-05 19:13:17
【问题描述】:

我需要在 UIView 中显示姓名、位置、地点、电话号码。 我没有使用主情节提要。

我有一个 UIViewcontroller 类

这里的示例是上传演示图像。请检查。

I need to display the data in UIView as screen shot

ListViewController.swift 和 ListViewController.xib 文件 怎么办?

【问题讨论】:

  • 显示你的代码。
  • @ShabbirAhmad 我试过stackoverflow.com/questions/49664340/…,但没有得到值
  • @ShabbirAhmad 如何解决问题
  • 你为什么不使用 UIViewController 和 Storyboard?用代码编写所有内容更易于理解,但对于刚开始的人来说则困难得多。
  • @MartinMuldoon 我需要在没有主情节提要的情况下这样做。

标签: ios


【解决方案1】:

首先删除您的MainStoryboard 文件,然后从infoPlist 中删除MainStoryboard。然后将您的ListViewController 设置为rootViewController 中的rootViewController,就像这样:

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
let listViewController = ListViewController().init(nibName:"ListViewController", bundle:nil) as ListViewController
self.window?.rootViewController = listViewController
self.window?.makeKeyAndVisible()
return true
}

然后在.xib 中设计您的视图,您可以从link 获得帮助

【讨论】:

    猜你喜欢
    • 2018-09-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多