What's the most Cocoaish way to show that a text field is invalid?

I have a text field which is validated whenever it loses focus. I want to be able to indicate that the value invalid during input so the user has the opportunity to correct their mistake before explicitly moving focus away from the box and triggering validation.

I have seen various implementations, including placing a red border round the field, a little icon that comes up for invalid input, or a bit of warning text.

What is the best way to do this in a way that complies with the conventions of Cocoa and the Apple Human Interface Guidelines?


Set its background to light red. This is what Adium does when you go over the message length limit in a Twitter tab.

The specific color Adium uses is:

  • Hue: 0.983
  • Saturation: 0.43
  • Brightness: 0.99
  • Alpha: 1.0
  • as a calibrated (Generic RGB) color.


    What about shaking the text field while making it slightly red? It may or may not work well in practice, but its used in the login field for both MobileMe and user switching on OS X.


    I like the Windows solution and implemented a small tooltip popup myself.

    I don't think that just changing colors doesn't will work. A textual explaination is often required too. Unfortunately MacOSX removed the balloon tips from old MacOS.

    链接地址: http://www.djcxy.com/p/2444.html

    上一篇: 在撰写评论时,将某种类型变为复数形式的好方法是什么?

    下一篇: 什么是最可可的方式来表明文本字段是无效的?