In this part of the IOS tutorial you will write the first IOS application, various steps involved in creating the application, its output and more.
To create the application in iOS, use the following steps: Step 1: Open Xcode and choose Create a new Xcode project to start a new project: Step 2 − Select Single View Application and click “Next”. Step 3: Fill specified information
Click next after filing the above information Step 4: Choose the directory for the project and choose create. Step 5: It will show a screen as follows: Step 6: Then choose iPhone simulator in the drop down close to Run button and choose run. Automatically Xcode creates the app and runs it in the Simulator. The simulator looks like as follows: It shows blank screen because app is incomplete. To end the app presses the Stop button. Step 7: Choose HelloWorldViewController.xib to complete your app. After choosing the file the editor changes to an interface builder and shows an empty view of app like as follows: Step 8: Select the UI controls from the right side panel. For this HelloWorld app select Round Rect Button” and drag it into the view. Try to place the button at the center of the view. Step 9: To alter the label of the button double press it and name it “Hello World” and then run the app again then it looks like as follows: Step 10: But this button does not perform any action so to perform action use the code. Choose the HelloWorldViewController.h then editor area now shows the source code of the chosen file. Insert the following line of code before the “@end” line:
After editing the file at the end it look like as follows: Step 11: Then choose the “HelloWordViewController.m” and add the code before the @end like as follows: After editing it look like as follows: Step 12: Now set up a link between the HelloWorld button & showMessage action. For this purpose, choose the HelloWorldViewController.xib file to go back to the Interface Builder. Press and grip the Control and click HelloWorld button & drag to the File’s Owner. Then it will look like as follows: Step 13: Release both buttons and displays the showMessage action. Choose it to build a link. Step 14: Then again run the app using simulator. It will display following output:
Your email address will not be published. Required fields are marked *
Solve : * 7 + 24 =