Comments

Iphone View based application to display Hello World




Step 1 - Create a new Project
Within Xcode select the menu option File-> New Project. Ensure application is selected under iPhone OS and then select 'View-based Application' and press the Choose button.


Step 2 - Name your project
You will then be asked to give your application a name, you can enter anything here but for this example I am going to call it VbHelloworld. Now press Save.


Step 3 - View default files created
If this is your first time this next screen may seem a little overwhelming, which is why im going to ask you to try and ignore it all for now, you will get to know what these files are for as and when you need to modify them. All you need to know at this stage is that put together these files contain all the information required to create your first iPhone app. So go ahead click the Build and Go button. Admittedly it does not do much, in-fact it just creates a blank screen so lets get onto the next step and put some text onto it.


Step 4 - Modify the MainWindow.xib file
Now you get to learn about the MainWindow.xib file, This stores all the visual info for the main window, which we are going to modify to include the Hello World text. Find this file in the root directory and double click on it, this will open up the Interface Builder and you will be presented with a screen similar to the one below.


I will just give a brief overview of what your looking at but again please don't panic about these screens you really don't need to know too much about them at this stage other than that they were created as part of the view-based application template.
• The MainWindow.xib window on the left basically shows all the components of your MainWindow.xib,
• The middle window is the View Controller of the actual view and if you click on the "Vb_HelloworldViewController� link you will see the actual view, we will be doing this in the next step.
• The third screen shows the library of objects that you can add to your iPhone App. If you don't see this screen you can access it by selecting Tools->Library from the Xcode menu bar.

Step 5 - Display the actual View
Click on the "Vb_HelloworldViewController� link within the View Controller to see the actual view and its associated information box. If the actual view window does not show as below, simply double click on the View icon in the objects window displayed on the left.


Step 6 - Add the Hello World text
Now simply drag the Label icon from the Library window onto your View. Once its there double click on it and change the text to 'Hello World'.


Step 7 - Save, Build and run
Right that's it. Simply close all the interface builder menus and select save when prompted. Now return to Xcode and Click 'Build and Go' and your App should be displayed as below.


iPhone application home





sapdev logo background
sapdev logo sapdev logo


Can't find something on ERPWorkbench? A quick search should fix that:




Related Articles