【发布时间】:2013-03-05 13:28:00
【问题描述】:
有没有办法获取已编码故事板文件的 NSCoder 中使用的密钥?我看到 PSTCollectionView 使用了很多未记录的密钥,他们是如何获得它们的?
具体来说,我想要在设置 UITableViewController 以在 IB 中自动使用 UIRefreshControl 时使用的键。
【问题讨论】:
标签: iphone objective-c key-value-observing
有没有办法获取已编码故事板文件的 NSCoder 中使用的密钥?我看到 PSTCollectionView 使用了很多未记录的密钥,他们是如何获得它们的?
具体来说,我想要在设置 UITableViewController 以在 IB 中自动使用 UIRefreshControl 时使用的键。
【问题讨论】:
标签: iphone objective-c key-value-observing
XIB(XML Interface Builder)是一个用 XML 创建的文件。
您可以使用 textEdit 或 wordPad 打开它。所以,问题解决了一半!!!
读取xib/nib文件的xml并解析。从那里读取所有密钥。
MainMenu.xib 的截图
<?xml version="1.0" encoding="UTF-8"?> <archive
type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data> <int key="IBDocument.SystemTarget">1080</int>
<string key="IBDocument.SystemVersion">11D50</string>
<string key="IBDocument.InterfaceBuilderVersion">2457</string>
<string key="IBDocument.AppKitVersion">1138.32</string>
<string key="IBDocument.HIToolboxVersion">568.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">2457</string>
</object>
【讨论】: