Saturday, 26 April 2014

Utility Area [Got Tools]

On the right side of your workspace window is the utility area. As the name suggests, it hosts a variety of useful tools, as shown in Figure 1-11.


Figure 1-11. Editing an Interface Builder file

At the top of the utilities area are the inspectors. These will change depending on what kind of file is being edited, and what you have selected. As with the navigators, you can switch between different inspectors by clicking onthe icons at the top of the pane, or from the View  Utilities submenu
(see Figure 1-12). You can hide the utility area using the View  Utilities  Hide Utilities command, or by clicking on the right side of the View control in the toolbar (see Figure 1-12).


Figure 1-12. Utility view controls


At the bottom of the utility area is the library. Here you’ll find ready-made objects, resources, and code snippets that you can drag into your project.

Debug Area

The debug area is used to test your app and work out any kinks. It usually doesnt appear until you run your app. To make it appear, odisappear, use the View  Debug Area  Show/Hide Debug Area  command. You can alsoclick on the close drawer icon in the upper-left corner of the debug pane.

Toolbar

The toolbar contains a number of useful shortcuts and some status information, as shown in Figure 1-13.


Figure 1-13. Workspace window toolbar

You’ve already seen the Editor and View buttons on the right. On the left are buttons to run (test) and stop your app. You will use these buttons to start and stop your app during development.

Next to the Run and Stop buttons is the Scheme control. This multi-part pop-up menu lets you select how your project will be built (called a scheme) and your apps destination (a simulator, an actual device, the AppStore, and so on).

In the middle of the toolbar is your projects status. It will display what activities are currently happening, or have recently finished, such as building, indexing, and so on. If you’ve just installed Xcode, it is probably downloadingadditional documentation in the background, and the status will indicate that.
You can hide the toolbar, if you want, using the View  Show/Hide Toolbar command. All of the buttons and controls in the toolbar are just shortcuts to menu commands, so its possible to live without it. This book,however, will assume that its visible.

If you’re interested in learning more about the workspace window, the navigators, editor, and inspectors, you will find all of that (and more) in the Xcode Overview, under the Help menu.

Running Your First App

Withyour workspace window open, click on the Scheme control and choose one of the iPhone choices from the submenu, as shown in Figure 1-14. This tells Xcode where you want this app to run when you click the Runbutton.


Figure 1-14. Choosing the scheme and target

Click the Run button. OK, theres probably one more formality to attend to. Before you can test an application, Xcode needs to be granted some special privileges. The first time you try to run an app, Xcode will ask if this is OK(see Figure 1-15). Click Enable and supply your account name
and password.


Figure 1-15. Enabling developer mode

Once you’re past the preliminaries, Xcode will assemble your app from all of the parts in your project—a process known as a build—and then run your app using its built-in iPhone simulator, as shown on the left in Figure 1-16.


Figure 1-16. The iPhone simulator

The simulator is just what it sounds like. Its a program that pretends—as closely as possible—to be a real iPhone, iPad, or iPod Touch. The simulator lets you do much of your iOS app testing right on your Mac, without everhaving to load your app into a real iOS device. It also allows you to test your app on different kinds of devices, so you dont have to go buy one of each.

Congratulations, you just created, built, anran an iOS app on a (simulated) iPhone! This workbecause Xcode project templates always create a runnable project; whats missing is the functionalitthat makes your app dosomething wonderful. Thats what the rest of this book is about.

While you’re here, feel free to play around with the iPhone simulator. Although the app you created doesnt have any functionality—beyond that of a lame “flashlight” app—you’ll notice that you can simulate pressing the home button using the Hardware  Home command and return to the springboard (the middle and right in Figure 1-16). There you’ll find your app, the Settings app, Game Center, and more, just as if this were a real iPhone. Sorry, itwont make telephone calls.

When you’re finished, switch back to the workspace window and click on the Stop button in the toolbar.


Summary

You now have all of the tools you need to develop and run iOS apps. You’ve learned a little about how Xcode is organized, and how to run your app in the simulator.

The next step is to add some content to your app.

No comments:

Post a Comment