Writing a login view for a mobile app is typically a lot of work. The complexity originates partially from the the multitude of login options your mobile app may support; username/password, Facebook, Twitter are among the popular choices. In addition, the login controller needs to handle the cases when the device is offline, when the user forgets his username/password, or when the server is down. Worst of all, just before you think you are done, you need to write a similar controller for sign up.
The above considerations make writing a login screen a daunting task.
Today, we are going to change that with the release of a drop-in view controller which handles all these edge cases for you.
PFLogInViewController in the Parse framework. With this class, creating a functional login view controller literally takes a minute. All you need to do is to create it and present it modally:
PFLogInViewController *logInController = [[PFLogInViewController alloc] init]; logInController.delegate = self; [self presentModalViewController:logInController animated:YES];
With these few lines of code, you will get a beautiful login screen, which is shown below. By default, it comes with login functionalities that include username/password field, a password forgotten button, and a sign up button.
What if you also want to support Facebook and Twitter? The
PFLogInViewController class is configurable, which means you can turn any feature on and off:
PFLogInViewController *logInController = [[PFLogInViewController alloc] init]; logInController.delegate = self; logInController.fields = PFLogInFieldsDefault | PFLogInFieldsFacebookButton | PFLogInFieldsTwitterButton; [self presentModalViewController:logInController animated:YES];
Now you are getting a login view controller that works with Facebook and Twitter. It looks great, and it works on the iPhone, iPad, portrait and landscape.
The following tutorial takes a more in-depth look at the new class: