• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
InterfaceBuilder 2.1 FAQ
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

InterfaceBuilder 2.1 FAQ


  • Subject: InterfaceBuilder 2.1 FAQ
  • From: Scott Herz <email@hidden>
  • Date: Mon, 1 Oct 2001 13:23:01 -0700

Before asking InterfaceBuilder questions on Cocoa-Dev, please consult the FAQ below. Some questions contain exquisite screen shots which are both helpful and inspiring. They have been removed to conserve bandwidth. Please select the Help:FAQ menu item in InterfaceBuilder to see this document in its entirety.

Thank You.

Frequently Asked Questions: version 2.1

The FAQs are grouped into the following categories:

 General
 Cocoa
 Carbon
 Project Builder Integration
 nibTool


General

 I have a question, concern or comment about InterfaceBuilder. Who can I talk to?

We really enjoy hearing your comments and requests. IB is very much a developer driven product. You can reach us via the feedback address:

email@hidden

or for help on these lists (subscribe at lists.apple.com)

cocoa-dev
carbon-development
projectbuilder-users

 What are the general parts of IB and what do they do?

IB has four main windows. The first window is the document window. It will generally appear in the lower left corner of your screen. It contains the nib's top level objects, class descriptions, images and sounds. Carbon documents don't contain class descriptions or sounds.

Another important IB window is the Info Panel. If it's not already visible, you can reach it via the menu Tools:Show Info. This window allows you to edit the attributes of selected objects.

The Palette window contains the set of widgets and objects for your framework. If it's not visible, you can bring it forward via the Tools:Palettes:Show Palettes menu. The palette window contains several different palettes. You can flip through them by clicking on the toolbar buttons.

The last important window is the design window. You will edit the contents of windows, dialogs and accessory views in a design window. Objects from the palette can be dropped on the design window for editing or added to the document window depending on the type of document it is.

 Does IB have any modifier keys? If so, what do they do?

Do we have modifier keys!

Command - Toggles your preferences for Inside-Out selecting and Aqua/User guide stickiness.
Option (Alt) - Shows measurement lines between selected widget and the widget under the mouse
Shows applicable Aqua guides if the mouse is over the selected widget
Creates a matrix if held why dragging a widget's grow knob (selected Cocoa widgets)
Extracts a widget if held while dragging. Use this to drag widgets into a dynamic palette
Control - Hold while dragging between objects to make connections (Cocoa only)
Hold and click over items in the class editor to bring up a contextual menu
Arrow keys - Nudges the selected widgets my one pixel
Reorders the selected tab view to the left or right
Shift - Hold while dragging widgets or resizing windows to constrain to an axis.
Hold while using the arrow keys to jump by 10 pixels instead of only one
Tab - Open the next string editor (Menus, matrices)
Switch tabs in a tab view
Space - Start editing the selected Menu
Return - Create a new outlet/action
Left Pedal - Disengages clutch

 What do the non-integral rectangle warnings mean and how do I get rid of them?

Non-integral rects are frame definitions which contain float values. Although not critical, these can lead to performance problems and blurring. IB will discover and correct any non-integral rects it finds when you open a nib. Versions of IB prior to 2.01 didn't always get this right. Things should be better now.

 How do I put widgets inside a container like a box or tab view?

Click on a category in the Palette toolbar. Click and drag a widget from the palette over your design window. A selection ring will draw around the deepest element that can accept the widget. Let up to drop it. Once an element is embedded in a container, it can only be removed by deleting or cutting it.

 How do I see the containment hierarchy of my document?

To see an outline of all the objects within your document and how they are related, click the button below. This button is located above the scrollbar in the document window. This view is a great way to select objects and widgets which may be difficult to reach though the design window. You can make connections from here too!

Outline/Icon toggle



 How do I switch tabs

Double click on an area of the tab view free of widgets. A ring will surround the tab view editor. Now click once on the tab you would like to view. You can also click the stepper control in the Info Pane.

 How do I edit tab titles?

Double click on an area of the tab view free of widgets. A ring will surround the editor. Double click on the text of the tab you wish to change. Enter the new text and press return.

 How do I add a tab to my tab view?

Select the tab in the design window. Bring forward the Attributes info panel in the info window. Add new tabs by increasing the number listed in that pane. Alternatively, you can double click on the tab to open its editor. Now copy and paste. You'll get a replica of the selected tab.

 How do I change the tab order of a tab view?

Double click on the tab view to open its editor. Select the tab you wish to reorder and press the arrow keys to reorder it.

 How do I edit a widget's properties?

Select the widget in the design window. Bring forward the Info window via the Tools:Show Info menu. Make your changes using the various Info panels.

 How do I add menus to the menubar?

To add individual items, drag an "Item" menu from the menu palette into your menu editor. To add a new submenu, drag a "Submenu" item from the menu palette into the menu editor. Double click these items in the menu editor to change their names. The other menu types in menu palette represent various system menus.

 How do I add menus to a popup button?

Double click the popup button. A menu editor will appear. Use the same techniques described above to add menu items to the editor.

 Can I create an interface without using Interface Builder?

Interface Builder is a tool which manipulates Cocoa and Carbon interface elements. You could manipulate these same elements programatically, but our guess is that you've got better things to do. If there is a reason why you can't use InterfaceBuilder, please send us a message and we'll investigate adding the functionality you need.

 Why is some text gray, and other text black.

Gray elements represent items defined by system frameworks. Often, these elements can't be deleted or changed. Files Owner, the NSApplicationIcon and the description for NSObject are examples of system defined elements.

 The guides drive me crazy sometimes. Can I turn them off?

Yes. You can turn off the automatic Aqua guides via the Layout:Disable Aqua Guides menu command. You can hide any user guides you have created with the Layout:Hide Guides menu command. Holding down the command key while you drag widgets around will temporarily reverse your guide settings. This is useful for people who normally like guide snapping, but are moving widgets in a confined space at the moment.

 How do I remove a user guide?

User guides can be removed from the document by simply dragging them off the edge of the window.

 How do I make sure my nib will be compatible with past versions of MacOS X?

New versions of IB will contain widgets and widget attributes unsupported by older version of Cocoa and Carbon. Use the menu item File:Compatibility Checking... to monitor your conformance to past versions.

 Does File Merge work with nibs?

Yes. You can compare two nib files using FileMerge to see what has changed, bit you can't merge to a new file. Behind the scenes, File Merge runs nibtool on the two nib files and diffs the textual output. If you are more comfortable with the command line diff tool, you can do the same:

nibtool -8a file1.nib > file1.txt
nibtool -8a file2.nib > file2.txt

diff file1.txt file2.txt

 Something is wrong with my Interface Builder preferences. How do I reset my preferences?

Quit Interface Builder. Open a Terminal window and type the following:

defaults remove com.apple.InterfaceBuilder

Next time you launch Interface Builder a new set of preferences will be created.



Cocoa Specific

 My favorite control exists in Carbon, but not Cocoa. What gives?

The goal is to support similar controls for both frameworks. They may not all be there yet. Stay tuned.

 What are custom views?

Custom views let you define subclasses of NSView to be instantiated at runtime. For example, say you have subclassed NSView to make a clock control called MyClockView. You can define this class type using the "Classes" tab, and then drag out a Custom View. Select the custom view and bring up the Custom Class info panel. This panel will show a list of NSView subclasses. Choose MyClockView. At runtime, when the Custom View is unarchived, an instance of MyClockView will be created instead.

You can also use Custom Views as simple containers of type NSView. Simply drag a widget off the palette over a CustomView and release after it highlights.

 Why isn't my initWithFrame: method called?

initWithFrame: is only called when you have added a Custom View object to your window. The initWithFrame: message is sent to the class you specified in the Attributes Info Panel. Other widgets will not recieve initWithFrame: messages. In this case you should just implement a -(void)awakeFromNib method to handle any further setup at runtime

 How do I use a custom view as an accessory view?

In the past, when developers wanted to create an accessory view for classes such as NSSavePanel, an entire NSWindow had to be created. The developer would then steal the content view of the window for use as the accessory view. Occasionally, the developer would forget to release the pillaged NSWindow, causing a leak.

There's a better way to do this now using Custom Views. Drag a Custom View off the palette and into your document window. It will appear as a top level object. Double click on the Custom View to open an editor for it. Make an outlet to connect to this object you can refer to it at runtime. Remember to release the CustomView when you're done with it!

 Should I release top level objects at runtime?

Usually, yes. The File's Owner is responsible for releasing any resources created by the nib. These include any top level objects such as formatters, custom views, extra window or extra menus. However, there are a few exceptions to this rule. Windows with the "Release on Close" flag set do not need to be released. They will release themselves when they close. Windows controlled by a window controller will also be release automatically.

 What does Instantiate do?

A frequent misconception of nibs is that they are simply recipes for recreating user interfaces at runtime. In reality, nibs contain actual archived objects. While most of these objects are in fact user interface elements, nibs can contain archived instances of other objects such as controllers and formatters. The "instantiate" command in the classes tab will cause the selected object to be created at runtime. It's common to instantiate a window's controller class along side the actual window in the nib. When the nib is loaded, the window and controller will be created and then any connections between them will be established.

 How do I put widgets inside a scroll view?

Select the widget(s) and use the menu item Layout:Group In:Scroll View. If only one item is selected, IB will attempt to make it the NSScrollView's document view. If more than one widget is selected, they will be enclosed in an NSView and that will be made the document view.

 How do I put widgets inside a split view?

Select the widget(s) and use the menu item Layout:Group In:Scroll View. If the widgets are arranged in a right to left fashion, the split will be vertical. Conversely, if they are arranged from top to bottom the split will be horizontal.

 How do I make a drawer?

There are two ways of creating drawers in IB. If you're starting from scratch, create an Empty nib. Now drag the composite drawer object off the window palette. The composite drawer object is the one that has a window with a drawer sticking off the left side of it. It's NOT the object that says Drawer. The composite drawer object contains a main window, a content view and an NSDrawer object. These objects come pre-wired. All you have to do is connect a widget to the "toggle" action of the NSDrawer object. Double click the content view icon to add views to it.

If you want to add a drawer to an existing window, just drag in the NSDrawer object (the one that says NSDrawer) and a custom view object. You'll use the custom view object as the content view for the drawer. Connect the NSDrawer's contentView and parentWindow to the custom view and existing window respectively.

 What do File's Owner and First Responder represent?

Files Owner and First Responder are proxies for objects that will exist at runtime. Specifically, Files Owner represents the object which will be passed in for owner in the method [NSBundle loadNibNamed: owner]. You can specify, via the Attributes Info Panel, what kind of object owner will be. Once you've indicated what Files Owner is, you can make connections to it.

First Responder is your portal to the Responder Chain. You can add Actions to First Responder in the "Classes" tab of the document window. Next, connect buttons and menu items to First Responder so that they call the desired action. The first object in the responder chain that understands this action will be called.

See the Cocoa documentation for more information about how the responder chain works.

 How do I setup the springs and struts so my views autosize?

Views can be made to resize automatically when the window or split view that contains them is resized. You will likely need to set the springs and struts for every view on your window. The easiest way to see how they work is to assign a few views with different settings and then File:Test Interface to see the results.

Bring up the Size info panel and select a simple square bevel button. There are two parts to Cocoa's auto sizing, growing and anchoring. How a view grows is determined by the strut/spring setting shown inside the mock button picture. If an axis (horizontal or vertical) is a spring, then the view can grow when its container is resized. If it's not a spring, but rather a strut, it will remain the same size.

Click on the horizontal axis inside the mock button. See how it turns into a curly spring? Now test the interface via the menu File:Test Interface. Grow the window in various directions. It gets longer, but never taller or shorter. Click the switch icon in the menu bar to stop testing the interface. Repeat this process, but with the vertical axis set as a spring. See how it can get taller or shorter but never wider?

The outer set of springs and struts represents how the view is to be anchored. If a segment is a strut, it will maintain a constant distance to its container along that side. However, if it's a spring the view will allow distance to vary.

Going back to our sample square bevel button, select it and click the left most segment so that it turns into a spring. Because the segment at right is still a strut, the view will maintain a constant distance along the view's right side, but will allow a variable distance along the left side. This has the effect of "sticking" the button to the right side of the screen. Test the interface and try it for yourself.

 How do I add a contextual menu with IB?

Select the Menu palette and drag the icon that looks like the picture below into your document. Now connect your view's menu outlet to this menu by control dragging from your view to the menu icon in your document.

Contextual menu:


 How do I use a formatter?

There are two ways to add formatters to widgets in IB. The easiest way is to just drag them on top of widgets that support formatters. You can then select the widget and bring up the Formatter Info pane to set the formatter's attributes. You can share a single instance of a formatter with several different widgets by dragging the formatter to the document window. Now connect your widget's "formatter" outlet to the formatter in the document window. As with any top level object, make sure to release it when you're done!

 How do I make a matrix (rows and columns) of a widget?

Any widget which has an NSCell counterpart, can be made into a matrix. Simply hold the option key down while you drag a selection knob. As you drag the knob further, new rows and columns will be appended to the matrix. Other widgets, such as NSBrower and NSForm work the same way.

 How do I give a browser more than one column?

Simply hold the option key down while you drag a selection knob. As you drag the knob further, new columns will be appended to the browser.

 How do I add a table column?

There are two ways to add columns to a table. The easiest way is to select the table and use the "#Colms" field to add new columns. Another way is to open the table's editor by double clicking on it. Now select a table column. Copy and paste it to make new ones.

 What do the (!) symbols in the document window mean?

These symbols appear whenever the object, or a child of that object, is missing a connection. Hold the mouse over the (!) symbol for a tool tip that further defines what's wrong. Switch to the Outline view to see which subview of a window is causing problems.

 How do I add a class definition?

Switch to the "Classes" tab in the document window. In this tab, you'll see a listing of all the class types this nib understands. All of the Cocoa objects are predefined, but you'll have to tell IB about your classes before you can make connections to them.

You can do this two ways. The easiest way is to parse your header files with the Classes:Read Files menu item. Select this menu and find the header for the class you wish to describe. IB will create a new listing for this class under its superclass and fill it with any actions or outlets defined in the header.

If you don't have the header file, you can subclass one of the class descriptions already defined in the "Classes" tab. Select a class, such as NSObject, and use the Classes:Subclass menu. Name the subclass. Now select your subclass and bring up the Attributes Info pane.

If this is to be a Java class, select Java in the inspector. Likewise, select Objective C if you want to create an Objective C class.

 How do I add outlets and actions?

You can only add outlets to a user defined subclass. But because of the protocol feature of Objective-C you can add an action to any classes either built in or used defined.

Select the "Classes" tab in the document window. Select the class definition you wish to add outlets and actions to. You will see the actions and outlets defined by the superclass listed in gray. You can add actions and outlets to your subclass by clicking the + buttons.

 I've made all of these class definitions in IB, can I write them out?

Yes! Select the class definition in the "Classes" tab and use the menu Classes:Create Files. If this nib is part of a loaded ProjectBuilder project, it may ask you if you would like to include the file(s) in a target. Depending on the type of class you're creating, you'll get a .m/.h set or a .java file.

 What are IBOutlet and IBAction doing in my code?

The short answer to this question is "not much". To really understand why they're added to your code, you must understand how IB parses your code. When you choose Classes:Read Files, IB tries to find the outlets and actions you've declared in your header. Long ago, we relied on these signatures:

for Outlets: id someOutlet;
for Actions: -(void)myAction:(id)sender

However, some people prefer stronger typing of their outlets, so they would try:

for Outlets: NSTextField* someOutlet;
for Actions: -(void)myAction:(MyApplication*)sender;

Nicely typed for sure, but IB couldn't tell the difference between these signatures and other non-outlet/non-action declarations, so it ignored them. To solve this dilemma, the no-op keywords IBOutlet and IBAction were introduced. Although the very first set of signatures still works, IB will also parse methods and fields containing these keywords as shown below:

for Outlets: IBOutlet NSTextField* someOutlet;
for Actions: -(IBAction)myAction:(MyApplication*)sender;

 How are outlets connected at runtime?

The runtime code will use the list of outlets you generated in IB at design time. For example, if you had specified an outlet called foo, IB will first investigate the target class to see if it responds to setFoo:(id). If it does, that method is called with the contents for foo. If setFoo:(id) doesn't exist, the instance variable foo itself is filled with the contents for foo.

 What is an object's custom class?

Many widgets have a Custom Class info pane. You can use this pane to specify that, at runtime, an object should be instantiated as a specific subclass. For example, you could make a subclass of NSApplication called MyApplication. To ensure that an instance of MyApplication is used at runtime, click the File's Owner of your main nib file. Bring up the Custom Class pane and select MyApplication.

Many controls can have custom classes. You could subclass NSSlider to add specific behavior. However, you still want to use IB's slider facilities. By setting the slider's custom class, your custom slider will be implemented at runtime, but a regular slider is used at design time.

 How do I make connections?

You make connections by holding down the control key while you click and drag from one object to another. For example, you want to connect an outlet of File's Owner to a text field. Hold the control key down and click and drag from the File's Owner icon to the text field you want to set as the outlet. A square will surround the text field. release the mouse.

Actions, typically, go the other direction. If you want to set the target/action of a button to an action in Files Owner, you would make a connection from the button to the File's Owner icon.

 I don't seem to be able to change my connections. What happened?

IB has a preference which will lock all connections for that user. This might be a good thing to do if you are localizing a nib and do not want to accidentally change any connections. Go to IB's main preference tab to change this setting.

 How do I make connections from my menu bar to my NSDocument subclass?

In your main nib add your window controller actions to the firstResponder and connect your menu item to the firstResponder. At runtime when one of your document window is key its window controller will be in the responder chain (because the window controller is the delegate of the window). Everything will work just fine. This is one of the reason for the existence of the firstResonder.

 Why can't I assign a custom Java subclass to an AppKit object?

The Java Bridge (which allows Java and Objective-C classes to communicate) implements the NSCoder protocol methods for every Java object that is a subclass of an Objective-C object. The problem is that the Java Bridge adds an initWithCoder: which expects some data within the coder stream. Unfortunately, this data does not exist.

 How do I subclass NSTextView in IB?

Unfortunately, you can't right now. We require extra Cocoa functionality to archive a subclass of NSTextView. This functionality is under review. A work around is to use a Custom View set to your subclass of NSTextView and grouped into a scroll view.

 How do I add palettes?

Third parties can extend InterfaceBuilder by developing palettes. These palettes can be installed in one of two ways. We will automatically load any palettes found in these directories:

~/Library/Palettes
~/Developer/Palettes
/Library/Developer/Palettes
/Developer/Palettes
/Network/Developer/Palettes

If you don't want to (or can't) store your palettes in these places, you can manage them yourself via the Palettes tab in IB's preferences. If you want to add a palette, click the add button.

 How do I remove palettes?

Palettes can be removed from the toolbar through the Tools:Palettes:Customize Toolbar menu. Just drag them off the toolbar after the customize sheet drops. If you would like to remove the palette from the list of available palettes, select the Palettes tab in IB's preferences. Here you can removed palette entries you have added. You can't remove palettes located in the directories listed in the question above. Remove the palette from the palette directory if you don't want it to appear in this list. Built-in IB palettes cannot be removed.

 What is a dynamic palette and how do I make one?

Dynamic palettes are created by the user. Select the menu Tools:Palettes:New Palette. A blank palette will be created for you. You can now option-drag widgets from the design window onto the palette. Option-drags containing multiple widgets will come off the palette as one unit. Save the palette using the menu Tools:Palettes:Save.

 I want to make a UI element smaller than the smallest size allowed by Interface Builder. How do I do that?

When resizing an UI element like a button or group box Interface Builder doesn't let you resize it past the minimum size defined by the Aqua User Guidelines. If you really need to resize it smaller then first resize it to its smallest size and then resize again. Interface Builder will let you resize an UI element past its minimum size if the current size is the minimum size.

 I have an outlet named "rate" and in the same class a method named "-setRate:". When my nib is loaded the -setRate: method is called. How come?

The rule to set outlet connections is as follow:

Given an outlet named foo we first look for a setter method named -setFoo:. If this method exist we call it passing the value of the outlet as parameter. If this method doesn't exist we then look for an instance variable named foo. If this instance variable exist we set it directly. If this instance variable doesn't exist an error is logged.

 I have a control in a container (e.g. tab view) and I want to move this control outside of the container but Cut and Paste break connections. How can I move a control bewteen containers without breaking connections?

This is a known limitation. The workaround is to Option-Drag the control to another window within the same nib file and then Option-drag it back to the original window (if you don't have a second window in your nib then create a temporary window). Option-drag witihin the same nib doesn't break connections.

 When I add more than 10K of text in a NSTextView in Interface Builder it crashes?

This is a known bug in the archiving mechanism in NSTextView, if you have add more than 10288 characters of text to a NSTextView IB will crash immediately. The workaround is to setup the TextView in Interface Builder but load in the text programatically (in your awakeFromNib method) into the text view.


Carbon Specific

 Do nibs work on MacOS 8/9?

Yes! IBCarbonRuntime.h has been a part of CarbonLib since version 1.1 (System 8.6). Because IBCarbonRuntime uses CFBundle, you will need to package your application correctly.

 Can I use nibs with PowerPlant or CodeWarrior?

Although IB doesn't support PowerPlant ppob's directly, you can unarchive a Carbon nib for use with standard Carbon functions.

 How do I load a nib in Carbon or CarbonLib?

See the sample code in /Developer/Examples/InterfaceBuilder/IBCarbonExample. It uses the CreateNibReference, CreateWindowFromNib and SetMenuBarFromNib functions to unarchive a Carbon nib. This example also shows how to register a simple Carbon event handler.

 How do I import a .rsrc file from Carbon?

IB can import the following compiled resource types: DLOG, DITL, CNTL, MBAR, MENU, WIND and tab#. DITL and CNTL resources will be mapped directly to appearance savvy controls. Make sure to select the correct text encoding before you import your resources. We do not support rez files at this time.

 Why don't my Carbon tabs switch at runtime or when I test the interface?

The Carbon tab control does not automatically switch tab panes for you. IB does this for you as a convenience at design time. Take a look at the example in /Developer/Examples/InterfaceBuilder/IBCarbonExample to see one way of switching tabs.

 Can I setup my custom controls in IB?

Two types of Custom Controls are supported: CDEF Proc Pointer and Event based custom controls. In both cases drag a "Custom" widget from the "Other" palette into your window and use the Info Panel to select a type of custom control. Look at the IBCarbonExample sample located in the /Developer/Examples/InterfaceBuilder folder for more details on how to use custom controls in your application.

Please note that a Carbon nib file which contains a custom control will not work on MacOS X 10.0.x machines.

 Does IB support MacApp?

No. Although you can unarchive a Carbon nib and manipulate it with standard Carbon functions.


Project Builder Integration

 How do I get IB to display images from my project?

Make sure the project is open in ProjectBuilder. Now open the nib. Carbon nibs will look inside compiled .rsrc files for PICT, icns, cicn and ICON resources. Cocoa nibs will discover any image type supported by NSImage, which should be just about anything.

IB will only show images it can guarantee will exist at runtime, so make sure your images are included in the target which contains the nib. If a nib belongs to multiple targets, it will only show images contained within every one of these targets.

 My nib lost all of its images! Where did they go?!

Project Builder must be running with your project open in order for IB to discover which images are available to you. If your project is open, but you still don't see any images, or only see a subset of images, check your target settings. IB will only show images it can guarantee will exist at runtime, so make sure your images are included in the target which contains the nib. If a nib belongs to multiple targets, it will only show images contained within every one of these targets.

 Will "create files" overwrite my existing files?

If the files IB is trying to write already exist, you will be given the option to merge your changes through File Merge. You can also tell IB to stop, or overwrite the existing files.

 I tried to drag an image into IB and it said I should use PB, but I don't want to.

If you really want to store files within the nib, and we don't recommend it, you can check the preference "Allow images to be stored inside the nib".

 I have problem adding nib files to my cvs repository

The easiest way to add a nib file to a cvs repository is to use CVSWRAPPERS. Simply create a .cvswrappers symlink in your home directory that points to the cvswrappers file located in the /Developer/Tools directory.

ln -s /Developer/Tools/cvswappers ~/.cvswrappers

That it. You can now add nib files to a cvs repository the same way you do with regular files.



nibtool Specific

 Why doesn't nibtool understand my objects.nib file?

Don't run nibtool against the object.nib file. Run it against the enclosing .nib directory. objects.nib, objects.xib, classes.nib, and info.nib are internal data structures packaged in a document wrapper.

 How can I localize my nib with nibtool?

First you need to generate the strings file for a particular nib file which is done like this:

nibtool -L myfile.nib > file.strings

file.strings will now contain entries such as "key" = "key" and be in Unicode (UTF-16) format. Next, give the resulting strings file to a translator and have them convert the second "key" entry to "key in other language"

Reprocess the foreign nibs using the converted strings file.

nibtool -d file.strings -w newLocalization.nib myfile.nib

nibtool will take the contents of file.strings and replace "key" in myfile.nib with "something in other language"

 I have already translated my nib file and adjusted the sizes of my widgets so the text doesn't clip. But now I have to add another widget to the development nib. When I translate this nib again, will I loose all of my size changes to the localized nib? How do I get the translation to maintain the size from the old nib file?

In this example, lets say we're translating an English nib to an Italian localization. What you need to get the file.strings and the Italian.nib file and use nibtool to generate a newItalian nib file like this:

nibtool -d file.strings -I Italian.nib -w newItalian.nib English.nib

nibtool uses the file.strings for the translation and Italian.nib for the size of objects. The resulting file newItalian.nib will have all of the objects size matching Italian.nib.


  • Follow-Ups:
    • Re: InterfaceBuilder 2.1 FAQ
      • From: Andreas Monitzer <email@hidden>
    • Re: InterfaceBuilder 2.1 FAQ
      • From: Matthew Formica <email@hidden>
  • Prev by Date: Re: Benchmarked: [NSBezierPath containsPoint:]
  • Next by Date: Re: [[object autorelease] release]
  • Previous by thread: Re: [Disregard] DVD problems, was: Early thoughts on 10.1
  • Next by thread: Re: InterfaceBuilder 2.1 FAQ
  • Index(es):
    • Date
    • Thread