2016-10-15 8 views
0

ユーザーがホームボタンを2回押したときやホーム画面に移動するときにコマンドを実行する方法を知っているのだろうかと思っていました。それはダブルタップすると、背景をぼかしたり、外出して戻ってであれば、ビューコントローラを閉じるようSnapchatは、Xcodeの7.3.1を使用した。app switcherが表示されたらcommand Xcode swift

をこれを行い、可能な場合は、コードはスウィフト2.2または2.3

のおかげかもしれません よろしく、

答えて

0

を使用フォアグラウンドからアプリの変更ホームボタンを押すのと同じように、バックグラウンドに移動します。

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

plzはあなたがしたときにコードを実行できるように二つの方法がありますあなたのAppdelegate.swiftファイルでは、あなたの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 throttle down OpenGL ES frame rates. 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. 
    } 
関連する問題