OS&Swift-UI ViewControllerライフサイクルの学習(英語)
viewWillAppear Called when content view created in memory What is content view?
→ When you create a new view controller (cocoatoach class) in your storyboard, a View object is created automatically. The content view aforementioned is this.
viewWillAppear Called just before content view is added to app's view hierarchy → Doesn't necessarily mean that it will "appear"in the screen as you can call view.isHidden = true sometimes.
→ This method is called everytime we come back to the View Controller.
→ viewDidLoad only gets called once because it is called when it is stacked in the navigation controller memory.
viewDidAppear Called after the content view is added to app's view hierarchy → You might want to configure animations in this method. Animations might start a little bit too soon if you put animation related code in viewWillAppear or viewDidLoad.
viewWillDisappear Called before the content view is removed from the app's view hierarchy → Often used when you want to save some sort of data right before the user dismisses the view.
viewDidDisappear Called after the content view is removed from the app's view hierarchy
override func viewDidLoad() {
super.viewDidLoad()
}
→ When you create a new view controller (cocoatoach class) in your storyboard, a View object is created automatically. The content view aforementioned is this.
viewWillAppear
override func viewWillAppear(_ animated: Bool){
super.viewWillAppear(animated)
}
→ This method is called everytime we come back to the View Controller.
→ viewDidLoad only gets called once because it is called when it is stacked in the navigation controller memory.
viewDidAppear
override func viewDidAppear(_ animated: Bool){
super.viewDidAppear(animated)
}
viewWillDisappear
override func viewWillDisappear(_ animated: Bool){
super.viewWillDisappear(animated)
}
viewDidDisappear
override func viewDidDisappear(_ animated: Bool){
super.viewDidDisappear(animated)
}
Reference
この問題について(OS&Swift-UI ViewControllerライフサイクルの学習(英語)), 我々は、より多くの情報をここで見つけました https://velog.io/@kevinkim2586/iOS-Swift-공부-UIViewController-Lifecycle-영テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol