22
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

LaunchScreenの表示時間を変更する方法

Posted at

#LaunchScreenとは
iOSアプリの起動時に表示される画面のこと。(数秒間ロゴが表示されるやつ)
xcodeでiOSアプリを作成する際には、自動でLaunchScreen用のstoryboard(LaunchScreen.storyboard)が作成されており、そこでデザインを決めることができる。

#やりたいこと
初期設定だと、この画面は一瞬表示された後すぐ消えてしまう。(ホントに一瞬!!)
なので、この表示時間を2秒間に変更したい。(世の中のアプリは大体このくらいの時間のイメージ)

#動作環境

  • swift 4.2
  • xcode 10.0

#行ったこと
AppDelegate.swiftの func applicationsleep(2)を追加。

変更前

AppDelegate.swift
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        return true
    }

変更後

AppDelegate.swift
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        sleep(2)           // <<<<<<<<<<<< 追加
        return true
    }

たったこれだけで、表示時間が変更されます。

22
17
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
22
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?