Open Hminchae opened 6 months ago
active → inactive 상태로 전환시 inactive 전환 직전 실행
잠시 전환되는 경우
inactive → background
background 상태전환 직후
application(_:willFinishLaunchingWithOptions:)
: 앱 실행시 호출되는 최초의 메서드이다. 최초로 실행할 코드 작성시 해당 메서드에 작성한다.application(_:didFinishLaunchingWithOptions:)
: 앱 실행을 위한 준비가 끝난 후, 화면이 사용자에게 보여지기 직전에 호출되는 메서드이다. 앱 실행을 위한 초기화 코드를 작성할 시 해당 메서드에 작성한다.applicationWillEnterForeground(_ application:)
: 앱이 Foreground 상태가 되기 직전에 호출되는 메서드이다. Background 상태에서 앱에 진입시 호출된다.applicationDidBecomeActive(_ application:)
: 앱이 inactive 상태에서 active 상태로 전환되면 호출되는 메서드이다. applicationWillResignActive(_ application:)
: 앱이 active 상태에서 inactive 상태로 전활될 시 호출되는 메서드이다.applicationDidEnterBackground(_ application:)
: 앱이 Foreground 상태에서 Background 상태가 되면 호출되는 메서드이다.
- applicationWillTerminate(_ application:)
: 앱이 종료되기 직전에 호출되는 메서드이다.
상태 변화에 따라 다른 동작을 처리하기 위한 앱델리게이트 메서드들을 설명하시오.
willFinishLaunchingWithOptions
state restoration
은 아직 아직 발생하지 않았음을 알린다.willFinishLaunchingWithOptions
에서 프로그램을 초기화 하고 실행할 준비를 한다.willFinishLaunchingWithOptions
는 앱이 실행되고 main storyboard 또는 nib 파일이 로드된 후 호출 됩니다InActive
상태 입니다.didFinishLaunchingWithOptions
didFinishLaunchingWithOptions
에서 앱의 초기화를 완료 하고 최종 변경 사항을 수행 한다.didFinishLaunchingWithOptions
는state restoration
이 발생했지만, 앱의 window와 다른 UI가 표시되기 전에 호출 된다.didFinishLaunchingWithOptions
메서드가 return 된 후, System은 다른 AppDelegate의 메서드를 호출하여 앱을 Active 상태 또는 Background 상태로 이동 시킨다.applicationWillEnterForeground
applicationWillResignActive
applicationDidBecomeActive
applicationDidBecomeActive
에서 앱이 InActive 상태인 동안 일시 중지되었던 작업들을 재개하여 이전에 앱이 Background에 있었다면 앱의 사용자 인터페이스를 새로 고치는 데도 사용할 수 있습니다.applicationDidEnterBackground
📝 참고 사이트