티스토리 뷰

iOS

In-Active State

@서비 2022. 4. 26. 00:58

1. 의미

foreground에서 background / background에서 foreground 로가는 중간 단계에 있는 state이다.

문자 혹은 전화가 왔을 때에도 In-Active상태가 된다.

 

 

 

2. 코드상 표현

 

ios13부터는 SceneDelegate에서 처리를 하는데 아래와 같이 보면 된다. 만약 벡 그라운드로 가거나 포어 그라운드로 올라올 때, 처리해야 하는 코드가 있으면, 2개의 코드에서 처리하면 된다.

sceneWillResignActive, sceneWillEnterForeground

 

 

  func sceneDidDisconnect(_ scene: UIScene) {
        NSLog("삭제될때")
    }

    func sceneDidBecomeActive(_ scene: UIScene) {
        NSLog("foreground")
    }

    func sceneWillResignActive(_ scene: UIScene) {
        NSLog("In-Active")
    }

    func sceneWillEnterForeground(_ scene: UIScene) {
        NSLog("In-Active")
    }

    func sceneDidEnterBackground(_ scene: UIScene) {
        NSLog("background")
    }

 

'iOS' 카테고리의 다른 글

lottie-ios quick start -1  (0) 2022.05.08
Frame 과 Bounds 의 차이  (0) 2022.05.07
Swift Final Keyword  (0) 2022.04.25
Swift Retain Cycle  (0) 2022.04.25
Firebase Analytics, Analytics.logEvent -2  (0) 2022.04.21
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/08   »
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
글 보관함