Window Base Application With Controls In iPhone

This is the Window base application, in this application we’ll see how to add image in background, add Label and Round Rect .Let see how to add it.

Step 1: Create a Window base application using template . Give the application name MyNewApp.

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: We need to add the resource file called as “Background.png” into the resource folder. Select resources and add files existing sources and select the backgroung.png.

Step 4: Now we’ll add view controller class to the project. Choose New file -> Select cocoa touch classes group and then select UIViewController subclass. Give the name myAppController.

Step 5: We need to add .xib file also. So select resource folder add -> new file -> User Interface -> View XIB , then give the name  ControllerView.xib file.

Step 6: We added UITextField , UILabel , nad one method in the myAppController.h file. So make the following changes in the myAppController.h file.




Step 7: Double click the ControllerView.xib file, open it to the Interface Builder. Single click File’s Owner icon and bring up Identity Inspector, change the class name myAppController. Connect File’s Owner icon to the View icon. Open the library from the interface builder and drag image view, place it to the View window. Select view and bring up attribute inspector, enter name as Background.png . Drag Text Field from the library and place it to the View window. Select it and bring up attributes inspector ¬†change the attributes. Place holder : Enter your name, Keyboard type : ASCII capable, Return Key : Default .

Step 8: Now select label from the library and drag it on the view window . Delect the label, keep it vacant. Open the connection inspector from the Interface builder to make the connections of the view elements to the File Owner. Select the text box and the Inspector will show the outlet delegate. Select delegate to the File Owner icon. Save your ControllerView.xib file and go back to the Xcode.

Step 9: Open the AppDelegate.m file and make the following changes:




Step 10: Now make the following changes in the myAppController.m file.




Step 11: Compile and run the application in the Simulator.

You can downloaded SourceCode from here MyNewApp 2

Leave a Comment: