2017-01-14 12 views
0

アプリを開いてバックグラウンドに行き、最後にフォアグラウンドに戻ったときに私のインターフェースに問題があります。だから、バックグラウンドから復帰したときに、常にアプリを起動させたいと思っています。 クラッシュ・ロワイヤルのゲームがそのように機能しているのを見ました。 私はすぐに開発しています3バックグラウンドから復帰した後にアプリを起動するよう強制する。 Swift 3

+0

http://stackoverflow.com/a/3098252/1072229試しましたか? –

答えて

1

あなたのホームページは、バックグラウンドから復帰した後にロードしたいと思うものは正確にはわかりませんが、AppDelegateの機能を使用してバックグラウンド状態からの復帰時や、アプリケーションの終了時に目的のビューを設定できるように、必要に応じて値を設定してシーンやビューをロードします。

AppDelegateに既に組み込まれている機能の一覧を示します。

func applicationWillResignActive(_ application: UIApplication) { 
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 
    // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 
} 

func applicationDidEnterBackground(_ application: UIApplication) { 
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 
} 

func applicationWillEnterForeground(_ application: UIApplication) { 
    // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 
} 

func applicationDidBecomeActive(_ application: UIApplication) { 
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 
} 

func applicationWillTerminate(_ application: UIApplication) { 
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 
} 
+0

何らかの理由で、applicationWillResignActiveがコードとしてフォーマットしませんでした。申し訳ありません。 – crpDave

+0

@LeoDabusを修正していただきありがとうございます。何らかの理由で私の編集を受け入れていなかった。 – crpDave

関連する問題