我正在尝试在
Xcode中创建自定义模板.在我的TemplateInfo.plist中,对于键选项,我将代码粘贴在下面.此模板将用于一个类,当事件发生时,通常会(但不总是)使用委托.
我遇到的问题是最底层的值,requiredOptions.我希望只有选中withProtocol复选框才能启用文本框.但是,我无法弄清楚要使用的值和值的类型.我尝试过以下方法:
>< true /> (如下所示) – 始终启用文本框.
>< string> YES< / string> – 始终禁用文本框.
><整数> 1< / integer> – 始终启用文本框.
有没有人对我能尝试的其他方法有任何想法?更好的是,有没有人知道Xcode模板的一个不错的参考?
我已经阅读了Apple的plist手册页和this website的文章.
<array> <dict> <key>Description</key> <string>The name of the class to create</string> <key>Identifier</key> <string>productName</string> <key>Name</key> <string>Class</string> <key>NotPersisted</key> <true/> <key>required</key> <true/> <key>Type</key> <string>text</string> </dict> <dict> <key>Default</key> <string>false</string> <key>Identifier</key> <string>withXIB</string> <key>Name</key> <string>With XIB for user interface</string> <key>Type</key> <string>checkBox</string> </dict> <dict> <key>Description</key> <string>Choose whether or not a delegate skeleton is included.</string> <key>Default</key> <string>false</string> <key>Identifier</key> <string>withProtocol</string> <key>Name</key> <string>With delegate skeleton</string> <key>Type</key> <string>checkBox</string> </dict> <dict> <key>Description</key> <string>The name of the protocol used for delegation.</string> <key>Identifier</key> <string>protocolName</string> <key>Name</key> <string>Protocol</string> <key>NotPersisted</key> <true/> <key>required</key> <true/> <key>Type</key> <string>text</string> <key>requiredOptions</key> <dict> <key>withProtocol</key> <true/> </dict> </dict> </array>
解决方法
我通过替换< true />来修复我自己的问题< string> true< / string>.