iPhone Interface Builder and its connection to Xcode


Interface Builder introduction

Interface Builder is a graphical development environment integrally tied in to Xcode. Whenever you write an Xcode project, it includes a .xib file that contains Interface Builder definitions for where graphical objects are placed. Each of the different Xcode templates comes with different objects prebuilt this way. Some of them have multiple, linked .xib files, with one file representing each separate screen of information. For now, be aware that Xcode and Interface Builder are designed to go together. Let's look at what's inside Interface Builder and then quickly look at how to mock up Interface Builder objects.

Anatomy of Interface Builder

You usually access Interface Builder by double-clicking a .xib file in your project. The default .xib file is generally called MainWindow.xib. Clicking it brings up the file in Interface Builder, showing how default objects have been designed.

NIB vs .XIB

You'll see talk of both .xib files and nib files. They're pretty much the same thing: a nib file is a compiled .xib file. They appear as .xib files in Xcode, but some methods call them nib files. Apple documents refer to a nib document window in Interface Builder; we've done the same here.

Interface Builder windows

When you call up Interface Builder, you initially see three windows: the nib document window, the main display window, and the Library window. The fourth important window - the inspector window - doesn't appear by default, but you'll call it up pretty quickly.

The nib document window displays top-level objects, which are objects without a parent. A default MainWindow.xib file includes four such objects. The window object is the one real object here; you can play with it in Interface Builder and also link it out to Xcode. As you'd expect, this is the window object that was created by default in the templates you've used so far.

The other three top-level objects are all proxies, which means they're placeholders for objects not contained in Interface Builder. Generally, you can only see objects in Interface Builder that were created there; if you need to access something else in Interface Builder, you do so by creating a proxy. The Webimage App Delegate is a proxy for the app delegate object. File's Owner refers to the object that manages the .xib file (usually either the application or a view controller), and First Responder refers to the top object in the responder chain. You'll meet these proxies again when we touch on IBOutlets.

The main display window shows what the .xib file currently looks like. Because we used the Window-Based Application template in Xcode, there's nothing here yet. If we'd used one of the other templates, you'd see tab bars or other prebuilt elements. In any case, this is where you arrange your user interface elements as you create them. Together, the nib document and main display windows contain all the objects understood by Interface Builder.

The Library window is where you can find all the UI elements you may want to add to your program. You can start exploring the library with a little mousing. Click the Library and Cocoa Touch Plugin toggles, and you'll see four main classes of UI elements:

The inspector window gives you access to a wide variety of information about an object and lets you change it; but it may or may not open automatically. If it isn't visible, you can call up the inspector by choosing Tools > Inspector. Afterward, whenever you click an object, its data will appear in the inspector. By default, the inspector window has four tabs: Attributes, Connections, Size, and Identity.

Legal Disclaimer

Our website is not responsible for the information contained by this article. Webworldarticles.com is a free articles resource thus practically any visitor can submit an article. However if you notice any copyrighted material, please contact us and we will remove the article(s) in discussion right away.


This article was sent to us by: Christian Glousten at 09232010

Related Articles

1. Market segmentation is a necessity when selling an iPhone iPad app
Segmentation starts when you post your app on the App Store through the categorization required by the store. Some developers are not sure what category their app should be...

2. Building Your Apps Total Message
Building Your App’s Total Message Some people think marketing your iPhone/iPad app consists of doing a little advertising and a press release. Actually, mar...

3. An effective iPhone iPad app name can help increase your sales
Choose an Effective App Name An effective iPhone/iPad app name can help increase your sales because the buyer does not have to invest as much effort to understand...

4. Your App Store text to help you captivate your readers attention
App Store Text: Lighten It Up In this mobile economy, people are reading less when it comes to their communications. Attention spans are short and, with the crush...

5. Your product website for App Store product page
Build a Simple, Clean Product Website Your product website should be similar in look and feel to your App Store product page. A carryover between the two sites wi...

6. Strive for Immediate Positive Reviews for your Ipad app
Strive for Immediate Positive Reviews There is nothing like getting a good reference. Whether you realize it, we all tend to listen to what other people say about...

7. Gets a positive review by an iPhone iPad app review site
Positive External Reviews Sometimes a developer is lucky in that his or her app gets a positive review by an iPhone/iPad app review site. That review gets picked ...

8. Your iPhone and iPad App Marketing Strategy
Coordinated Marketing Effort The first step is to make sure that all your marketing content uses your newly created unique message, “Your iPhone and iPad Ap...

9. Direct marketing can be done through direct mail marketing or email marketing
Direct Marketing for Your App Direct marketing can be done through direct mail marketing or email marketing. Here we look at the pros and cons of both methods....