在 Nib 文件中使用常量
我有一个带有几个笔尖的应用程序,笔尖是根据配色方案构建的。现在我需要更改配色方案。因此,我需要转到每个笔尖及其中的每个组件并更改其颜色。
我想知道是否可以告诉笔尖从“#define”中读取颜色,这样将来就可以很容易地进行此类更改。
或者任何其他方式来更改笔尖内容,不是通过转到每个笔尖并更改它,而是通过在一个中心位置进行更改。
I have an App with few Nibs, the Nibs are built according to a color scheme. Now I have a requirement to change the color scheme. So I need to go to each Nib, and each component in it and change its color.
I was wondering whether I can tell the Nib to read the color from a "#define" so it would be easy to make these kind of changes in the future.
Or any other way to change the Nib content not by going to each Nib and changing it but by doing it is a central place.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
目前无法在 Nib 文件的上下文中使用常量或定义的符号。您应该考虑通过 http://bugreporter.apple.com 向 Apple 提交针对此功能的增强请求。
There is currently no way to use constants or defined symbols inside the context of a Nib file. You should consider filing an enhancement request with Apple at http://bugreporter.apple.com for this functionality.
为每个需要颜色定制的元素设置
IBOutlet
然后在代码中设置颜色不合适吗?Wouldn't be suitable to set
IBOutlet
for each element that required color customization and then set color in code?即使在使用其他颜色创建笔尖后,您仍然可以在 viewDidLoad 函数或任何其他函数中将其背景颜色值更改为 #define-ed 值。
Even after creating the nib with some other colour, you can still change its the background colour's value in lets say the viewDidLoad function or in any other function to the #define-ed value.