Skip to content
This repository was archived by the owner on Aug 16, 2023. It is now read-only.

Customizing Interface Elements

Caleb Davenport edited this page Jan 22, 2014 · 3 revisions

Most SimpleAuth providers need to present user interface elements to the user. For example, the Twitter provider shows a UIActionSheet if the user needs to select an account from a list. Likewise, the Tumblr provider needs to show a view controller so that the user can log in to the Tumblr website.

You can customize behaviors such as these by configuring the SimpleAuthPresentInterfaceBlockKey and SimpleAuthDismissInterfaceBlockKey for a given provider. Each of these blocks accepts a single argument and has no return value.

You can configure this globally if you like:

SimpleAuth.configuration[@"tumblr"] = @{
    // consumer_key and consumer_secret
    
    // Change navigation controller class
    SimpleAuthPresentInterfaceBlockKey : ^(UIViewController *controller) {
        MyCustomNavigationController *navigation = [[MyCustomNavigationController alloc] initWithRootViewController:controller];
        UIViewController *root = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
        [root presentViewController:navigation animated:YES completion:nil];
    }
};

Clone this wiki locally