A few months ago I decided to apply for a job at a software company, I interviewed for IOS developer position. After a week I got a result they gave me an offer 400$ per months, salary not too high, not too low for me


I also struggled with a lot of questions from my interviewer, so today in this article I will share with you my experiment to answer the question from the interviewer
if you are IOS developer you are familiar with viewWillAppear, viewDidAppear, viewDidLoad, viewWillDisappear, and viewDidDisappear
let me ask you a question what is the running order of viewDidAppear, viewDidLoad, viewWillDisappear, and viewDidDisappear.This question sounds easy it’s straightforward. Actually, it very hard to answer, because when you make app maybe you don't care about it, No one tells you before you get an interview, now we need to create a new project, inside of ViewController.swift we need to implement some methods look like this
After that, we need to hit command+R to run our project and, I also put some breakpoint in order to see what going on
As you can see the running order is
1 viewDidLoad
2 viewWillApear
3 viewDidApear
4 viewWillDidDisappear
5 viewDidDisappear
Summarize
1 viewDidLoad: is called when only when the controller loads the view, viewDidLoad only do a thing once, you should do things that you only have to do once in viewDidLoad – like setting your UILabel texts.
2 viewWillApear: is called before the view is added, This happens always after viewDidLoad and is called every time the view is displayed.
3 viewDidApear: is called after the view is added
4viewWillDidDisappear: is called before the view is removed
5 viewDidDisappear: is called after the view is removed
I hope this useful for you before you get an interview, please leave your comment below this article
Comments
Post a Comment