Present the Logon Screen

To present the MAF Logon UI, adjust your root view controller; however, do not change your root view controller interface.


This example shows how to implement the view controller (ViewController.m). It first gets the logonHandler from the AppDelegate singleton, and then sets the parentViewController property of the MAFLogonUIViewManager class to point to the root view controller (self):
#import "ViewController.h"
#import "MyLogonHandler.h"
#import "AppDelegate.h"

@interface ViewController ()
@property (nonatomic, retain) MyLogonHandler *logonHandler;

@implementation ViewController

- (void)viewDidLoad
    [super viewDidLoad];
    AppDelegate* appDelegate = [[UIApplication sharedApplication] delegate];
    self.logonHandler = appDelegate.logonHandler;
    self.logonHandler.logonUIViewManager.parentViewController = self;



The view controller (MainViewController.m) is responsible only for setting the self reference as the parentViewController property of the MAFLogonUIViewManager. The Logon UI is presented using the parentViewController reference.

You can now run the project to see the default MAF logon UI. The MAF Logon UI appears if you call the logon selector on the Logon Manager from the appdelegate when the application becomes active.