Learn how to implement the classic Hello World app for the iPhone — no coding required. The tutorial also has the added bonus of supporting multiple orientations.
For my first iOS tutorial on TechRepublic, I will describe how to create the typical Hello World application for iPhone, which we will build on in future posts. I assume you have an Intel-based Mac with Xcode installed.1. Launch Xcode and create a new project by clicking the Create A New Xcode Project button on the splash screen (Figure A). Or, if you dismissed the splash screen, you can select File | New | Project from the menu. Select Single View Application from the list of templates. Figure A
- Product Name is Hello.
- Device Family is set to iPhone.
- Use Storyboards is not selected.
- Use Automatic Reference Counting is selected.
The project will be created and set up with specific files based on these initial settings.
3. Click Next and pick a location to store the project. Xcode will create a Hello folder under whichever folder you select.4. Build and run the application by selecting Product | Run from the menu or by pressing Command-R. You should see iPhone simulator launch and the application running inside of it. The app currently displays a blank grey view (Figure C). Figure C
5. The app already supports multiple orientations. In order to test this in the simulator, you can select Hardware | Rotate Right from the menu. Notice that it will rotate into portrait and both landscape orientations.6. Click the main project file from the file navigator to view a Summary of the project (Figure D); this allows you to set the Bundle Identifier, Version, supported Devices, Deployment Target, Initial Orientations, Icons, and Splash screens. All of these settings are specified in the Info.plist file, which you can get to by clicking the Info tab. However, most of the common things you will modify are in the Summary tab. I will skip over all of the settings that are available to your app, but you should learn them prior to submitting to the App Store. Figure D
That's it! The classic Hello World app was implemented without coding, and we get the added bonus of supporting multiple orientations. In my next TechRepublic tutorial, you will do some coding to turn this application into a functioning clock.