ios – 在Xcode中创建自定义模板 – 如何根据复选框创建所需选项?

ios – 在Xcode中创建自定义模板 – 如何根据复选框创建所需选项?,第1张

概述我正在尝试在 Xcode中创建自定义模板.在我的TemplateInfo.plist中,对于键选项,我将代码粘贴在下面.此模板将用于一个类,当事件发生时,通常会(但不总是)使用委托. 我遇到的问题是最底层的值,RequiredOptions.我希望只有选中withProtocol复选框才能启用文本框.但是,我无法弄清楚要使用的值和值的类型.我尝试过以下方法: >< true /> (如下所示) – 我正在尝试在 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>. 总结

以上是内存溢出为你收集整理的ios – 在Xcode中创建自定义模板 – 如何根据复选框创建所需选项?全部内容,希望文章能够帮你解决ios – 在Xcode中创建自定义模板 – 如何根据复选框创建所需选项?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1007369.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-22
下一篇 2022-05-22

发表评论

登录后才能评论

评论列表(0条)

保存