0

I want to read the Xib files of other projects and the edit them programmatically using Xcode (say deleting a button or text possible).

Possible?

Cœur
  • 37,241
  • 25
  • 195
  • 267
yathish
  • 13
  • 3
  • xib files???? u mean from source code. ryt? What do u exactly mean by "other project" here? – Baby Groot Jul 22 '13 at 11:23
  • yeah. Other project in the sense not in the same bundle or an independent external Xib file. – yathish Jul 22 '13 at 11:28
  • Yes. You can add that xib. Probably you will need to change it's name and need to add .h and .m files to change nething in that xib. – Baby Groot Jul 22 '13 at 11:36
  • Y don't u simply try that once with any sample code. – Baby Groot Jul 22 '13 at 11:37
  • What I understand is Xib's are internally translated into xmls. But i don't think editing that xml is so easy. I wanna know is there any alternative for that. Say writing an apple script for doing the job done or reading and editing using obj-c – yathish Jul 22 '13 at 11:47
  • Do you mean doing it in an app running on the device altering the xib files of other apps? – Fogmeister Jul 22 '13 at 11:55
  • 1
    You should provide a bit more detail about what you want to achieve. Bottom down any xib is an industry standard xml file which could easily be edited - given that you know what you are doing in the context of binding the definitions within the nib file to the remaining prjoect(s). But I've got a guts feeling that you are better of with alternative approces. If you would just share your goals with us. – Hermann Klecker Jul 22 '13 at 12:00
  • Its like doing it in a app running on a machine altering a local copy of the Xib file in the same machine. Hope am clear – yathish Jul 22 '13 at 12:02
  • Hermann Klecker, aim is to develop a tool which browse the Xib file given the path and do a edit on them like deleting a button or textfield or a menu item (which are pre-known) and to save the file – yathish Jul 22 '13 at 12:07
  • Xib files aren't “internally translated into xmls”; they *are* XML documents. Accordingly, you can use any XML processing machinery (XSLT, your favorite XML parser or document-interpreter, etc.) to manipulate it, just so long as you don't violate any of the reasonably-obvious rules (e.g., don't create two objects with the same id, or delete an object without breaking any and all references to it from other objects). – Peter Hosey Jul 23 '13 at 03:17

2 Answers2

0

Yes it is possible. You can edit xib files(XML) using textedit also.

<object class="NSMenuItem" id="425164168">
    <reference key="NSMenu" ref="720053764"/>
    <bool key="NSIsDisabled">YES</bool>
    <bool key="NSIsSeparator">YES</bool>
    <string key="NSTitle"/>
    <string key="NSKeyEquiv"/>
    <int key="NSKeyEquivModMask">1048576</int>
    <int key="NSMnemonicLoc">2147483647</int>
    <reference key="NSOnImage" ref="35465992"/>
    <reference key="NSMixedImage" ref="502551668"/>
</object>
MZimmerman6
  • 8,445
  • 10
  • 40
  • 70
Parag Bafna
  • 22,812
  • 8
  • 71
  • 144
0

You can try this.

The correct answer was given by user763308 at url "How to link a .xib file to a class file with Xcode 4":

To link a .xib to a class under Xcode4:

Open your .xib. In placeholder: select File's Owner. In the third thumbnail:"Identity Inspector" of the right panel, edit the "Custom Class" field and enter the name of your class. I also then had to:

Click the root view under Objects. Click the last tab: "Show Connections". Drag "New referencing outlet" to "File's Owner" and select "view".

Community
  • 1
  • 1
Rajeev Barnwal
  • 1,349
  • 11
  • 14