Create A LoginScreen In iPhone

In this application we will see how to create a LoginScreen in iPhone. This is the very simple application. Let see how it will be worked using Interface Builder.

Step 1: Create a new application using View base template.Give the application name “LoginScreen”.

Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.

Step 3: xpand classes and notice Interface Builder created the LoginScreenViewController class for you. Expand Resources and notice the template generated a separate nib, LoginScreenViewController.xib, for the “LoginScreen”.

Step 4: In this LoginScreenViewController.h file we have added two UITextField for username and password, one UIButton for login, UIActivityIndicatorView for indicator and added one IBAction method. So make the following changes in the file.

 

 

 

Step 5: Double click the LoginScreenViewController.xib file and open it to the Interface Builder. First drag two label from the library and place it to the view window, change the label name into Username and Password.Again drag two TextField from the library and place it to the view window. Next drag Button and ActivityIndicator from the library and place it to the view window. Now connect File’s Owner icon to View icon and select the view. Select the File’s Owner icon and bring up Connection Inspector next drag indicator to the Gray Activity Indictor, another time drag from the userName and password to the two TextField. Select RoundRect button and bring up Connection Inspector next drag from the TouchDown to the File’s Owner icon and select loginButton: action. Now save it , close it and go back to the Xcode.

Step 6: Open the LoginScreenViewController.m file and make the following changes in the file.

 

 

 

Step 7: Now compile and run the application in the Simulator.

You can Downloaded SourceCode from here LoginScreen