11. View Controller
• Important property in UIViewController
@property (retain) UIView *view;
a pointer to top-level UIView in the Controller’s View
• View Controller have a “lifecycle” from creation
to destruction
- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)aBundle;
initializer
12. View Controller
• After the UIViewController is initialized,
viewDidLoad is called
- (void)viewDidLoad;
• Just before the view appears on screen, you
get notified
- (void)viewWillAppear:(BOOL)animated;
13. View Controller
• Creating a UIViewController’s UI in code
(no .xib, no storyboard)
• override - (void)loadView;
• set self.view
*Do NOT implement loadView if you use a storyboard/.xib to create the
UIViewController.
*Do NOT set self.view anywhere else besides in loadView.
*Do NOT implement loadView without setting self.view (i.e. you must set
self.view in loadView).
14. Segues a pointer to top-level UIView in the Controller’s View
16. MVC
should
did
will target
controller
outlet
count
Notification
de
data
da
& KVO
le
ta
ga
action
te
so
urc
es
model view
17. General process for building
iPhone application
1.
Create
a
simple
MVC
iPhone
applica5on
2.
Build
interfaces
using
Interface
builder
3.
Declara5ons
a.
Declaring
instance
variables
b.
Declaring
methods
4.
Make
connec5ons
a.
SeDng
a
pointer
b.
SeDng
targets
and
ac5ons
5.
Implemen5ng
methods
a.
Ini5al
method
b.
Ac5on
methods
6.
Build
and
run
on
the
simulator
7.
Test
applica5on
on
the
device
24. Create a FB iOS App
https://developers.facebook.com/docs/guides/mobile/
25. Step1: Registering your iOS App with Facebook
https://developers.facebook.com/apps/
Step 2: Installing the iOS SDK
git clone git://github.com/facebook/facebook-ios-sdk.git use git clone
https://github.com/facebook/facebook-ios-sdk OR download it directly
Step 3: Implementing Single Sign-On (SSO)
*access_token