2. Behind The Scene: HelloWorld (Single View Application)
• ViewController is the File’s Owner of ViewController.xib. File’s Owner
represents the object that loaded the nib file from disk and owns this copy of
the nib file.
2
3. Behind The Scene: HelloWorld (Single View Application)
• ViewController has a view linked to View
3
4. Revisit: iOS Application Life Cycle
Souce: http://developer.bada.com/article/A-Comparison-between-iOS-and-bada-Application-Development-Part1 4
5. main() => UIApplicationMain()
• principalClassName
• Pass nil when you have no UIApplication
subclasses
• delegateClassName
• Pass a custom class that implements
UIApplicationDelegate protocol
5
6. AppDelegate.h
• This class implements UIApplicationDelegate Protocol.
• AppDelegate is the delegate of UIApplication object.
• AppDelegate has two properties (named “window”, and “viewController”)
which are instance of UIWindow and ViewController
6
7. AppDelegate.m
• UIWindow has a property named “rootViewController”, which is now pointed
to viewController object.
7
17. Model-View-Controller (MVC) Design Pattern
• Model (any data in your program)
Are separated in such a manner
that modifying either the view or
• View (what the user sees) model component of your
program has no effect on one
• Controller (a layer that handles another.
all interaction between the view and model)
17
18. What Files Are In The Project?
• Source Files
• AppDelegate.h & AppDelegate.m
Controller
• ViewController.h & ViewController.m
View
• ViewController.xib / MainStoryboard.storyboard
• Supporting Files
• HelloWorld-Info.plist
• main.m
18
38. Conclusion for HelloWorldEmptyWindow
• Create a new xib file • Goto AppDelegate.h and put
New File -> Window -> IBOutlet in front of UIWindow
MainWindow.xib *window;
• Click at File's Owner of • Goto Window.xib again and
MainWindow.xib -> change this connect window under Outlets to
class to UIApplication Window
• Drag and drop an Object under
Objects -> select the third tab on • Also in plist file add a row
the right -> change this class to Key: Main nib file base name
AppDelegate
Type: String
• Right click at File’s Owner and Value: MainWindow
connect delegate to App Delegate
38
39. MainWindow.xib
• Drag and drop Round Rect Button and change text into Say Hello
Where to write action code?
39
53. Revisit: New File > Objective-C class > ViewController
• Enter Class: ViewController, choose Subclass of UIViewController, and forget
to select With XIB for user interface
53