Online Book Reader

Home Category

iPhone Game Development - Chris Craft [24]

By Root 1574 0
functional application. Go ahead and give it a try by clicking Build and Go. What's left? You need to remove the iPhone Status Bar at the top of the screen. You need to add content to your Flipside View—it will make a great About Us screen when you're done. And you need to give your application a custom icon.

To remove the Status Bar from the top of the screen, add one line of code to the beginning of your awakeFromNib function:

[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];

About Us screen

Next, you will add the Flipside View content. From the Xcode Project Explorer, choose Groups & Files⇒HelloWorldEx⇒Resources⇒FlipsideView.xib. Double-click on FlipsideView.xib to open it in Interface Builder, and you should see a blank canvas ready to hold your ideas. We have a lot of options for what we could do with this screen and how we could do it. But to keep things simple starting out, we are going to add a full-screen graphic to this form. This is an easy but powerful way to present to the application user almost anything we want.

You can either use the aboutus.png from the sample code or create one of your own. We will add this graphic to the screen in the same manner as the starfield.png and the earth.png files. Under Groups & Files in Xcode, find the Resources folder under HelloWorldEx. Right-click on the Resources folder and choose Add⇒Existing Files.

Now locate the aboutus.png image you will use and choose Add. Check the Copy items into destination group's folder (if needed) check box and keep everything else on their default settings. Set Reference Type to Default, set Text Encoding to Unicode (UTF-8), and make sure the option Recursively create groups for any added folders is selected. When you're done, click the Add button.

From inside Interface Builder, choose Tools⇒Library. As you did earlier in the chapter, click on an Image View and drag it onto the Flipside View form. You can find the Image View control under Objects⇒Library⇒Cocoa Touch Plugin⇒Data Views. After you have placed the UIImageView control on the form, make sure it fills the entire screen and choose Tools⇒Inspector. On the first tab, Image View Attributes, set the Image field to your chosen aboutus.png file. Your Flipside View form should now look similar to the one in Figure 2.25.

Click Build and Go in Xcode to see the application as it now stands. To get to the About Us screen, click the small info icon in the bottom-right corner of the screen. We do have a little touching up left to do on the About Us screen. By default the Flipside View's title text is set to the application's project name, which is HelloWorldEx in our case. This is not the most user-friendly message we could give, so we should go ahead and change it now.

Going back to Xcode, one way to update the text is to choose Edit⇒Find in Project, and search for the text HelloWorldEx. Xcode should find one occurrence of HelloWorldEx that is located in the RootViewController.m file. You can double-click the filename in the search results to open the file directly. Or you can locate the file inside the Xcode Project Explorer's Groups & Files list under HelloWorldEx⇒Application Controllers⇒RootViewController.m. Once you find the HelloWorldEx text, change it to Hello World. Feel free to give the application another spin to see the corrected text at run-time.

FIGURE 2.25

The About Us screen


Application icon

Finally, you need to add a custom icon to your application and set the application name to finish it off. Again, you can use either the icon.png file we provided or one of your own. Use Xcode to add your selected icon.png to the Resources folder as you did with previous images. Once you have done this, in Xcode choose Groups & Files⇒Targets⇒HelloWorldEx. Right-click on HelloWorldEx and choose Get Info. You should see the following tabs at the top of the form: General, Build, Rules, Properties, and Comments. Click on the Properties tab and set the Icon File field to icon.png. Click on the General tab and set the Name field to Hello World. Click Save, and

Return Main Page Previous Page Next Page

®Online Book Reader