Telerik Software Academy Mobile apps for iPhone & iPad.
-
Upload
leonard-bond -
Category
Documents
-
view
225 -
download
5
Transcript of Telerik Software Academy Mobile apps for iPhone & iPad.
![Page 1: Telerik Software Academy Mobile apps for iPhone & iPad.](https://reader036.fdocuments.net/reader036/viewer/2022062320/56649d005503460f949d2efe/html5/thumbnails/1.jpg)
iOS Application Lifecycle
Insert a Picture Here
Telerik Software Academyhttp://academy.telerik.com
Mobile apps for iPhone & iPad
![Page 2: Telerik Software Academy Mobile apps for iPhone & iPad.](https://reader036.fdocuments.net/reader036/viewer/2022062320/56649d005503460f949d2efe/html5/thumbnails/2.jpg)
Table of Contents iOS app Execution model
UIApplication object
UIApplicationDelegate object
UIViewController Lifecycle
Events
State
2
![Page 3: Telerik Software Academy Mobile apps for iPhone & iPad.](https://reader036.fdocuments.net/reader036/viewer/2022062320/56649d005503460f949d2efe/html5/thumbnails/3.jpg)
UIApplicationExecution model and lifecycle
![Page 4: Telerik Software Academy Mobile apps for iPhone & iPad.](https://reader036.fdocuments.net/reader036/viewer/2022062320/56649d005503460f949d2efe/html5/thumbnails/4.jpg)
Execution model – Entry Point
iOS Application main function:
#import <UIKit/UIKit.h>#import "AppDelegate.h"
int main(int argc, char * argv[]){ @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); }}
4
Called in the main entry point to create the application object, delegate and set up the event
cycle
![Page 5: Telerik Software Academy Mobile apps for iPhone & iPad.](https://reader036.fdocuments.net/reader036/viewer/2022062320/56649d005503460f949d2efe/html5/thumbnails/5.jpg)
UIApplicationDelegate
UIApplicationDelegate – protocol declares methods that are implemented by the delegate of the singleton UIApplication object.
AppDelegate – implements the application delegate to expose the control over the UIApplication
5
![Page 6: Telerik Software Academy Mobile apps for iPhone & iPad.](https://reader036.fdocuments.net/reader036/viewer/2022062320/56649d005503460f949d2efe/html5/thumbnails/6.jpg)
UIApplication: States Application states:
Not Running – the app is not launched
Inactive – the app is running in the foreground but is currently not receiving events
Active – the app is running in the foreground but is receiving events
Background – the app is running in the background and executing code
Suspended – the app is in the background but is not executing code
6
![Page 7: Telerik Software Academy Mobile apps for iPhone & iPad.](https://reader036.fdocuments.net/reader036/viewer/2022062320/56649d005503460f949d2efe/html5/thumbnails/7.jpg)
UIApplication: States (2)
7
![Page 8: Telerik Software Academy Mobile apps for iPhone & iPad.](https://reader036.fdocuments.net/reader036/viewer/2022062320/56649d005503460f949d2efe/html5/thumbnails/8.jpg)
UIApplication – Launch Cycle
8
![Page 9: Telerik Software Academy Mobile apps for iPhone & iPad.](https://reader036.fdocuments.net/reader036/viewer/2022062320/56649d005503460f949d2efe/html5/thumbnails/9.jpg)
UIViewController States
Overview and usage
![Page 10: Telerik Software Academy Mobile apps for iPhone & iPad.](https://reader036.fdocuments.net/reader036/viewer/2022062320/56649d005503460f949d2efe/html5/thumbnails/10.jpg)
Overview: UIViewController
UIViewController: Provides the fundamental view-
management model
Coordinates its efforts with model objects and other controller objects communication
Responsible for a single view
States preservation and restoration
10
![Page 11: Telerik Software Academy Mobile apps for iPhone & iPad.](https://reader036.fdocuments.net/reader036/viewer/2022062320/56649d005503460f949d2efe/html5/thumbnails/11.jpg)
UIViewController – API (1)
Managing the View view – the root view of the
controller’s view hierarchy
viewDidLoad – it is called after the view controller has loaded its view hierarchy into memory
Handling Memory Warning didReceiveMemoryWarning
Sent to the view controller when the app receives a memory warning
11
![Page 12: Telerik Software Academy Mobile apps for iPhone & iPad.](https://reader036.fdocuments.net/reader036/viewer/2022062320/56649d005503460f949d2efe/html5/thumbnails/12.jpg)
UIViewController – API (2)
Responding to View Events viewWillAppear
Notifies that its view to be added to a view hierarchy
viewDidAppear Notifies that that its view is added to
a view hierarchy
viewWillDisappear Notifies that its view is about to be
removed from a view hierarchy12
![Page 13: Telerik Software Academy Mobile apps for iPhone & iPad.](https://reader036.fdocuments.net/reader036/viewer/2022062320/56649d005503460f949d2efe/html5/thumbnails/13.jpg)
UIViewController – API (3)
viewDidDisappear Notifies that its view is about to be
removed from a view hierarchy
viewWillLayoutSubviews Called to notify the view controller
that its view is about to layout its subviews
viewDidLayoutSubviews Called to notify the view controller
that its view has just laid out its subviews 13
![Page 14: Telerik Software Academy Mobile apps for iPhone & iPad.](https://reader036.fdocuments.net/reader036/viewer/2022062320/56649d005503460f949d2efe/html5/thumbnails/14.jpg)
UIViewController - Lifecycle
14
![Page 15: Telerik Software Academy Mobile apps for iPhone & iPad.](https://reader036.fdocuments.net/reader036/viewer/2022062320/56649d005503460f949d2efe/html5/thumbnails/15.jpg)
Questions?
iOS Application Lifecycle