How to modify .xib file outside of xcode?

I have a .xib file. I open it with a text file or Dashcode or something else.

Let's say that it has 4 buttons. Anyway, but with different names.

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

However, these things are represented by a reference number, which, apparently, cannot find a place in the folder of my project, connecting it with the actual image, color or font.

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

So the 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 answers. Now I can drag xib into xcode. But when I make a new application, I want to use the existing xib, but with different colors. I will use php to automatically create this code file. Then just drag it back. I have done this for all of my .h and .m and viewcontrollers. I need to understand this .xibs.

+4
source share
3 answers

The xib files contain the XML generated by IB in Xcode. If you edit this XML, there is no guarantee that your changes will not be destroyed by IB the next time he writes the file.

But if I understand you correctly, you are trying to peek into the contents of xib to better understand how to create a user interface programmatically. The software-generated user interface is not executed by writing xib files. You can get a hint about which options can be configured in IB, but there is a lot of content in xib that is distracting if that is what you are trying to do.

+3
source

Earlier in Xcode 3.2 and earlier there was an Interface Builder application that functioned outside of Xcode ... but now it is part of Xcode. You can google for the Builder interface now also ... But I think that the apple does not allow you to have the Builder interface separately ....

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

+1
source

I am working on an xib decoder written in C #, and even if at the moment it is not possible to edit the xib file, you can display it and see how it looks. The xib parser is open source and is a Cocoa open source implementation called GNUstep. Parser can be found here: https://github.com/smartmobili/CocoaBuilder .

0
source

Source: https://habr.com/ru/post/1389683/


All Articles