xcode 将 NIB 文件转换为 XIB 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10064108/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Convert NIB Files to XIB Files
提问by Elmo
Is there a way to convert NIB
files to XIB
files so that I can open them in Xcode 4? Once I have edited them, is there a way to convert them back to NIB
?
有没有办法将NIB
文件转换为XIB
文件,以便我可以在 Xcode 4 中打开它们?一旦我编辑了它们,有没有办法将它们转换回NIB
?
回答by Rob Napier
Once a nib file has been flattened and stripped (which is now a default part of the compilation process), then it is challenging to open it in IB. You may want to look at NibUnlocker, which is useful in converting a flattened nib file into xib, but it is not a lossless round-trip and it may not even work in all cases. As with most decompilers, much of the useful editing information has already been thrown away.
一旦一个 nib 文件被扁平化和剥离(现在这是编译过程的默认部分),那么在 IB 中打开它是具有挑战性的。您可能想查看NibUnlocker,它在将扁平化的 nib 文件转换为 xib 时很有用,但它不是无损往返,它甚至可能不适用于所有情况。与大多数反编译器一样,许多有用的编辑信息已经被丢弃。
For more information on xib compilation, see ibtool(1).
有关 xib 编译的更多信息,请参阅ibtool(1)。
回答by Devarshi
I have made a simple application to accomplish this task, here is the link: NibToXibConverter
我做了一个简单的应用程序来完成这个任务,这里是链接:NibToXibConverter
Here is the code: NibToXibConverter@github
Hope it helps :-)
希望能帮助到你 :-)
回答by Adobels
It's impossible to open a compiled "nib" file. I have tried to achieve that on a compiled nib file from an "ipa" downloaded from the AppStore with the tool "ibtool". Below is a result:
打开已编译的“nib”文件是不可能的。我尝试使用工具“ibtool”在从 AppStore 下载的“ipa”编译的 nib 文件上实现这一点。下面是一个结果:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.ibtool.errors</key>
<array>
<dict>
<key>description</key>
<string>Interface Builder cannot open compiled nibs.</string>
<key>recovery-suggestion</key>
<string>Try opening the source document instead of the compiled nib.</string>
</dict>
</array>
</dict>
</plist>
This is a result of NibUnlocker App:
这是 NibUnlocker 应用程序的结果:
The document “MainViewController.nib” could not be opened. The NIB file “file://localhost/Users/xxx/MainViewController.nib” does not contain a keyedobjects.nib file. Perhaps it is of a later format that NibUnlocker does not yet recognize.
无法打开文档“MainViewController.nib”。NIB 文件“file://localhost/Users/xxx/MainViewController.nib”不包含 keyedobjects.nib 文件。也许它是 NibUnlocker 尚不识别的较新格式。