0
0

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 1 year has passed since last update.

【Swift】スプラッシュ画面の表示方法

Posted at

LaunchScreen.storyboardを使用する

  1. LaunchScreen.storyboardを選択します。
  2. ストーリーボードエディターで、スプラッシュ画面のデザインを作成します。
  3. AppDelegate.swiftファイルを開き、以下のコードを追加します。
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

    // Override point for customization after application launch.

    Thread.sleep(forTimeInterval: 2.0) // 2秒間スリープ

    return true

}

上記のコードでは、アプリが起動する際に、2秒間スリープしてからアプリを表示します。

これにより、スプラッシュ画面が表示されます。

スプラッシュ画面の表示時間を変更する場合は、Thread.sleep(forTimeInterval: 2.0)の値を変更してください。

最後に

iOSアプリ開発をしています。
主にSwiftですが、最近は熱が入ってきてFlutterも🦾
色々やってます。もし良かったら見てってください。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?