❓왜 콜백 메소드라 부를까?
: 내가 직접 호출하는 것이 아니라 시스템이 호출하는 것이기 때문
cf. func loadView()
: Creates the view that the controller manages.
You override this method only in case you want to build the whole interface for the view controller from code.
func viewDidLoad()
: Called after the controller's view is loaded into memory.- view controller의 lifetime 중 한번만 불림!
- Usually override this method to perform additional initialization on views.
- 이 단계에서 view bounds는 아직 최종 결정되지 않음 (
viewWillLayoutSubViews
에서 결정됨)
func viewWillAppear(Bool)
: Notifies the view controller that its view is about to be added to a view hierarchy.func viewDidAppear(Bool)
: Notifies the view controller that its view was added to a view hierarchy.func viewWillDisappear(Bool)
: Notifies the view controller that its view is about to be removed from a view hierarchy.func viewDidDisappear(Bool)
: Notifies the view controller that its view was removed from a view hierarchy.
뷰가 나타나고, 사라지고라고 표현할 수도 있지만 뷰계층에 추가되고, 뷰계층에서 제거되고라고 표현하면 좀 더 팬시하지 않을까 😇