Iphone course 3
-
Upload
janet-huang -
Category
Technology
-
view
590 -
download
0
Transcript of Iphone course 3
iPhone Application Development IIIJanet Huang2011/12/07
Today’s topic
• iOS programming review
• Facebook API
• Location + Facebook App
overview of iPhone application
Key objects in an iOS app
View Controller
View Controller
• Important property in UIViewController
• View Controller have a “lifecycle” from creation to destruction
@property (retain) UIView *view;
a pointer to top-level UIView in the Controller’s View
- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)aBundle;
initializer
View Controller
• After the UIViewController is initialized, viewDidLoad is called
• Just before the view appears on screen, you get notified
- (void)viewDidLoad;
- (void)viewWillAppear:(BOOL)animated;
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).
Segues a pointer to top-level UIView in the Controller’s View
Review
- Objective-C - Class, Methods, Properties, Protocols, Delegation
- MVC and UIViewController - MVC design - View Controller
- Interface Builder or Storyboard
- Delegation & Target-action
- Application Lifecycle
MVC
controller
model view
outlet
target
delegate
data sources
shoulddid
will
count
data
action
Notification & KVO
General process for building iPhone application
1. Create a simple MVC iPhone applica5on2. Build interfaces using Interface builder3. Declara5ons
a. Declaring instance variablesb. Declaring methods
4. Make connec5onsa. SeDng a pointerb. SeDng targets and ac5ons
5. Implemen5ng methodsa. Ini5al methodb. Ac5on methods
6. Build and run on the simulator7. Test applica5on on the device
Facebook API
FB iOS SDK• Methods
• Authentication
• Dialog
• Request
• Protocols
• FBDialogDelegate
• FBRequestDelegate
• FBSessionDelegate
SearchBookmark
https://developers.facebook.com/docs/guides/mobile/
Create a FB iOS App
https://developers.facebook.com/apps/
Step1: Registering your iOS App with Facebook
Step 2: Installing the iOS SDK
git clone git://github.com/facebook/facebook-ios-sdk.git
https://github.com/facebook/facebook-ios-sdk
use git cloneOR download it directly
Step 3: Implementing Single Sign-On (SSO)*access_token
Step 1:
Step 2:
Step 3:
Step 4:
Step 5:
Step 6:
modify the app property list file
Test it!! :D
Add Requesting Additional Permissions
Add Graph API
Add Social Channel
Request
News Feed
Implementation & Integration