Facebook Developers
DocsToolsSupportNewsApps
Log In
  • Social Plugins
  • Facebook Login
  • Open Graph
  • Facebook APIs
  • Games
  • Payments
  • App Center
  • Promote Your App
  • iOS
    • Getting Started
    • Concepts
    • Reference
  • Android
  • JavaScript
  • PHP
  • More SDKs
  • Class References
    • FBCacheDescriptor
    • FBFriendPickerViewController
    • FBGraphObject
    • FBLoginView
    • FBPlacePickerViewController
    • FBProfilePictureView
    • FBRequest
    • FBRequestConnection
    • FBSession
    • FBSessionTokenCachingStrategy
    • FBTestSession
    • FBUserSettingsViewController
    • FBViewController
  • Protocol References
    • FBFriendPickerDelegate
    • FBGraphLocation
    • FBGraphObject
    • FBGraphPlace
    • FBGraphUser
    • FBLoginViewDelegate
    • FBOpenGraphAction
    • FBPlacePickerDelegate
    • FBUserSettingsDelegate
    • FBViewControllerDelegate
  • Other References
    • FBError
    • FBSettings

FBViewController

SDK Reference › iOS SDK › FBViewController
FBViewController
Inherits from: UIViewController
Declared in: FBViewController.h
Overview

The FBViewController class is a base class encapsulating functionality common to several other view controller classes. Specifically, it provides UI when a view controller is presented modally, in the form of optional Cancel and Done buttons.

Tasks
cancelButton property
canvasView property
delegate property
doneButton property
- presentModallyFromViewController:animated:handler:
FBModalCompletionHandler typedef
Properties
cancelButton

The Cancel button to display when presented modally. If nil, no Cancel button is displayed. If this button is provided, its target and action will be redirected to internal handlers, replacing any previous target that may have been set.

@property (nonatomic, retain) IBOutlet UIBarButtonItem *cancelButton;
Declared In
FBViewController.h
canvasView

The view into which derived classes should put their subviews. This view will be resized correctly depending on whether or not a toolbar is displayed.

@property (nonatomic, readonly, retain) UIView *canvasView;
Declared In
FBViewController.h
delegate

The delegate that will be called when Cancel or Done is pressed. Derived classes may specify derived types for their delegates that provide additional functionality.

@property (nonatomic, assign) id<FBViewControllerDelegate> delegate;
Declared In
FBViewController.h
doneButton

The Done button to display when presented modally. If nil, no Done button is displayed. If this button is provided, its target and action will be redirected to internal handlers, replacing any previous target that may have been set.

@property (nonatomic, retain) IBOutlet UIBarButtonItem *doneButton;
Declared In
FBViewController.h
Instance Methods
presentModallyFromViewController:animated:handler:

Provides a wrapper that presents the view controller modally and automatically dismisses it when either the Done or Cancel button is pressed. If Done is pressed, the block provided by the doneHandler parameter is called.

- (void)presentModallyFromViewController:(UIViewController*)viewController animated:(BOOL)animated handler:(FBModalCompletionHandler)handler;
Parameter
viewController

The view controller that is presenting this view controller.

animated

If YES, presenting and dismissing the view controller is animated.

handler

The block called when the Done or Cancel button is pressed.

Declared In
FBViewController.h
Typedefs
FBModalCompletionHandler

A block that is passed to [FBViewController presentModallyInViewController:animated:handler:] and called when the view controller is dismissed via either Done or Cancel.

typedef void (^FBModalCompletionHandler)(
FBViewController *sender,
BOOL donePressed);
Discussion

Pass a block of this type when calling addRequest. This will be called once the request completes. The call occurs on the UI thread.

Declared In
FBViewController.h

Last Updated: November 19, 2012
Facebook © 2013 · English (US)
AboutAdvertisingCareersPlatform PoliciesPrivacy Policy