【问题标题】:Is there any way that can edit the launch screen?有什么方法可以编辑启动屏幕吗?
【发布时间】:2015-04-10 11:10:54
【问题描述】:

我已按照以下链接的教程进行操作:

http://oleb.net/blog/2014/08/replacing-launch-images-with-storyboards/

但是,它不会运行 viewDidLoad 中的任何代码。此外,当我将 IBoutlet 用于 UILabel 时,启动屏幕变黑。

有什么方法可以在 UIViewController 中编辑 UILabel 吗?

【问题讨论】:

  • 不,启动故事板或 nib 仅加载,但从未运行任何代码。
  • 查看SO answer
  • 您不能在 LaunchScreen.xib 中使用您的类,因此您的任何代码都不会在其中运行。

标签: ios iphone swift


【解决方案1】:

那是因为您在 iOS 7 或更低版本的设备上进行测试。

您只能为 iOS 8 指定启动屏幕 xib。

早期版本需要启动图像。

【讨论】:

    【解决方案2】:

    这是另一个“解决方案”,它制作了一个假的启动屏幕(Main.Storyboard 中的第一个 UIViewController)并将 Main.Storyboard 设置为启动屏幕。然后在viewDidLoad()中插入代码

    迅速:

    let delay = 3 * Double(NSEC_PER_SEC)
    let time = dispatch_time(DISPATCH_TIME_NOW, Int64(delay))
    dispatch_after(time, dispatch_get_main_queue()) {
        self.performSegueWithIdentifier("yourVCIdentifierInStoryboard", sender: self)
    }
    

    【讨论】:

      猜你喜欢
      • 2016-05-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-25
      • 2022-11-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多