Rick
Rick

Reputation: 1163

How do I modify a .xib file outside of xcode?

I have a .xib file. I open it up with textfile or Dashcode or what ever.

Say it has 4 buttons on it. All the same but with different titles.

My goal is to change the color, font, and background image outside of xcode automatically and then import the file into xcode.

However these things are represented by a reference number that I can't seem to find any where in my project folder connecting it to the actual image, color, or font.

<reference key="IBUINormalBackgroundImage" ref="650551563"/>  <!-- Button Background -->

So a button looks like this

`<!-- Button 1 -->
<object class="IBUIButton" id="580622739">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 124}, {280, 37}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="810145050"/>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<reference key="IBUIFont" ref="881065587"/>           <!-- Button Font Type -->
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Facebook</string>     <!-- Button Name -->
<reference key="IBUIHighlightedTitleColor" ref="587412318"/>
<reference key="IBUINormalTitleColor" ref="523599070"/>       <!-- Button Font Color -->
<reference key="IBUINormalTitleShadowColor" ref="457053782"/>
<reference key="IBUINormalBackgroundImage" ref="650551563"/>  <!-- Button Background -->
</object>

`

EDIT: Based on some responses. What I can do is drag and drop a xib into xcode now. But when I am making a new app I want to use an existing xib but with different colors. I will use php to auto create this code file. Then just drag and drop again. I have done this for all my .h and .m and viewcontrollers. I need to figure this out for .xibs.

Upvotes: 4

Views: 5069

Answers (3)

Vince Ricosti
Vince Ricosti

Reputation: 519

I am working on a xib decoder written in c# and even if for the moment it's not possible to edit a xib file it's possible to display it and see what it looks like. The xib parser is open-source and is a translation of the open source implementation of Cocoa called GNUstep. Parser is available here : https://github.com/smartmobili/CocoaBuilder.

Upvotes: 0

Jim
Jim

Reputation: 5960

The xib files contain XML generated by IB in XCode. If you edit this XML, there is no guarantee that your changes won't get wiped out by IB the next time it writes the file.

But if I understand you correctly, you are trying to peek at the xib contents to get a better understanding of how to create a UI programmatically. Programmatically generated UI's are not done by writing xib files. You may get a hint about what parameters can be configured in IB, but there is a lot of content in a xib that is distracting, if that's what you are trying to do.

Upvotes: 3

DShah
DShah

Reputation: 9866

Previously in Xcode 3.2 and earlier, there was Interface Builder app which was functioning outside of Xcode... but now it is a part of Xcode. You can google for Interface Builder now also...But i think apple does not allow you to have Interface Builder separately....

general link : http://guides.macrumors.com/Interface_Builder

Upvotes: 1

Related Questions