Invalid color System, labelColor (warning given only once)

拥有回忆 提交于 2019-12-30 08:11:05

问题


I am getting following warning on OS X 10.9 console at the time of nib load(NSWindowController).

Invalid color System, labelColor (warning given only once)

I am using Xcode 6 and OS X 10.10 to compile my code. Most probably this warning is coming because of NSColor exposes new system colors in 10.10 for static text and related elements: labelColor, secondaryLabelColor, tertiaryLabelColor, and quaternaryLabelColor.

How to fix this warning?


回答1:


Change your textfield's color in your xib file from:

<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>

to:

<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>

Since "labelColor" is not a formal color name in OSX 10.9.




回答2:


The warning is there to inform you the color is not available in 10.9 (or below). You could simply check the OS version (using AppKit constant NSAppKitVersionNumber) and handle the color properly according to the version.

Good reading: Apple Developer Guide on SDK Compatibility



来源:https://stackoverflow.com/questions/27507727/invalid-color-system-labelcolor-warning-given-only-once

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!