View Controller and Application Life Cycle in IOS
If you have not study my last tutorials click here: Learn Objective c
For Learn Swift Click here:Learn Swift
Application Life Cycle in IOS:
Whenever your application run in IOS your code and System Framework plays role behind that.
System Framework includes all the required User Interface Cocoa Control(button,tableview etc) That demand by your code while running application.
Also that above dependency between code and system work depends upon MVC model.
If you have some programming background you already familiar with it. I will describe lator about it.
As you have seen my last tutorial of Objective C i have used console widely with main class. But in IOS you have not seen. Actually it does not appear but Xcode creates it automatically When you click on Any template of view controller,DetailviewController or takes the assumptions with every basic project.
In general C programming you need to write Main function even in java ,In C++ each of your class executed by creating object inside of main function.
you can see main function when some error occured while building application in Xcode.
There is UIApplicationMain function in Xcode who manages MVC.
Model View Controller:
The UIApplicationMain function manages when to load view and where data comes in model and when to control application in controller from delegates.
Model: Model describes the model about application.General A model describes the data used in Real world object from application is derived.
It stores the data needed for run apps. Like If you have created apps for University or academic work of student record The Database used for app stored in model.
Learn Last tutorial of IBoutlets and IBAction click here: IBoutlets and IBAction in IOS
Controller: Controller who control the code behind the scenes whether it is delegate or some other.
Controller include Application Delegate which generally linked with model time to time.
Like if you want to handle row selection in table view of Student record apps then delegate object request time to time with Model for data manipulation.
There is also UIApplication object in Controller includes all the bundle required to run apps.
View: View include all the front end required elements like Cocoa Control like button,TableView ,Sliders etc.
There is UIWindow object who worked behind it.
How to appears on IOS simulator or iPhone Device ?
It is the work of UIWindow object to manage or run the application.
Now Take a quick look at how application run in IOS?
When user click on touch of iPhone, the touch event is fired and the request goes to Operating System which is IOS. Now IOS decide at which port application can run.
After that a queue of events are generated which means separates object of different control according to their needs like motion,accelerometer,camera.
Now There is main loop who manages all the main thread activities requested to UIApplication object one by one from event queue.
Here UIApplication object processes that request and provides resources if needed like camera to camera,sound like activities etc.
Application can change their states according to condition.
These states are: Foreground,background,suspended
You have seen various methods in app delegate .m like willEnterBackgroundState etc. then what to print.
Foreground is state normal when your application is running.
I am not going into the detail of Application state change. You can study from internet.
The application can be terminated by IOS if any interrupt occurs like low memory issue and multitasking,running apps in background or suspended without informing.
You can study my last tutorial of concurrency: Concurrency In IOS
I hope you like my tutorial. If you have any query can mail me and comment here.
My next tutorial will be Table View Apps.
If you have not study my last tutorials click here: Learn Objective c
For Learn Swift Click here:Learn Swift
Application Life Cycle in IOS:
Whenever your application run in IOS your code and System Framework plays role behind that.
System Framework includes all the required User Interface Cocoa Control(button,tableview etc) That demand by your code while running application.
Also that above dependency between code and system work depends upon MVC model.
If you have some programming background you already familiar with it. I will describe lator about it.
As you have seen my last tutorial of Objective C i have used console widely with main class. But in IOS you have not seen. Actually it does not appear but Xcode creates it automatically When you click on Any template of view controller,DetailviewController or takes the assumptions with every basic project.
In general C programming you need to write Main function even in java ,In C++ each of your class executed by creating object inside of main function.
you can see main function when some error occured while building application in Xcode.
There is UIApplicationMain function in Xcode who manages MVC.
Model View Controller:
The UIApplicationMain function manages when to load view and where data comes in model and when to control application in controller from delegates.
Model: Model describes the model about application.General A model describes the data used in Real world object from application is derived.
It stores the data needed for run apps. Like If you have created apps for University or academic work of student record The Database used for app stored in model.
Learn Last tutorial of IBoutlets and IBAction click here: IBoutlets and IBAction in IOS
Controller: Controller who control the code behind the scenes whether it is delegate or some other.
Controller include Application Delegate which generally linked with model time to time.
Like if you want to handle row selection in table view of Student record apps then delegate object request time to time with Model for data manipulation.
There is also UIApplication object in Controller includes all the bundle required to run apps.
View: View include all the front end required elements like Cocoa Control like button,TableView ,Sliders etc.
There is UIWindow object who worked behind it.
How to appears on IOS simulator or iPhone Device ?
It is the work of UIWindow object to manage or run the application.
Now Take a quick look at how application run in IOS?
When user click on touch of iPhone, the touch event is fired and the request goes to Operating System which is IOS. Now IOS decide at which port application can run.
After that a queue of events are generated which means separates object of different control according to their needs like motion,accelerometer,camera.
Now There is main loop who manages all the main thread activities requested to UIApplication object one by one from event queue.
Here UIApplication object processes that request and provides resources if needed like camera to camera,sound like activities etc.
Application can change their states according to condition.
These states are: Foreground,background,suspended
You have seen various methods in app delegate .m like willEnterBackgroundState etc. then what to print.
Foreground is state normal when your application is running.
I am not going into the detail of Application state change. You can study from internet.
The application can be terminated by IOS if any interrupt occurs like low memory issue and multitasking,running apps in background or suspended without informing.
You can study my last tutorial of concurrency: Concurrency In IOS
I hope you like my tutorial. If you have any query can mail me and comment here.
My next tutorial will be Table View Apps.
No comments:
Post a Comment