아이폰 앱 생명주기
아이폰을 개발하면서, 필요한 항목을 정리 중입니다.
앱의 생명주기는 아래와 같이 4가지로 나뉜다.
Not Running: 앱이 실행되지 않은 상태
(Inactive와 Active 상태를 합쳐서 Foreground 라고 함)
Inactive: 앱이 실행중인 상태 그러나 아무런 이벤트를 받지 않는 상태
Active: 앱이 실행중이며 이벤트가 발생한 상태
Background: 앱이 백그라운드에 있는 상태 그러나 실행되는 코드가 있는 상태
Suspened: 앱이 백그라운드에 있고 실행되는 코드가 없는 상태
AppDelegate.swift의 delegate 설명
application(_:didFinishLaunching:) - 앱이 처음 시작될 때 실행applicationWillResignActive: - 앱이 active 에서 inactive로 이동될 때 실행applicationDidEnterBackground: - 앱이 background 상태일 때 실행applicationWillEnterForeground: - 앱이 background에서 foreground로 이동 될때 실행 (아직 foreground에서 실행중이진 않음)applicationDidBecomeActive: - 앱이 active상태가 되어 실행 중일 때applicationWillTerminate: - 앱이 종료될 때 실행
ViewController 생명주기
댓글
댓글 쓰기