Focus! Focus!

Test resultsYesterday, I made reference to the contentVerticalAlignment property of UIControls. Upon further examination, it may not be such a good idea to use this property, for a somewhat surprising reason. If you look carefully at the screenshot to the left (click for a full-size view) you’ll see that the non-first-responder UITextFields are blurry.

Details

This bug(?) appears to have the following behaviour:

  • If a UITextField is the First Responder, it renders normally
  • Otherwise, its text is rendered with a very subtle (1-2 pixel) blur

The blurring isn’t particularly noticeable unless you rapidly switch focus from one field to another, in which case you can see the text “jitter” quite a bit.

A Pun?

There’s sort of neat metaphor here: We normally speak of the control which captures keyboard input as having “focus”; in JavaScript DOM programming, the method to lose focus is even called “blur”. Here we see a visual representation of this metaphor; the controls without focus are literally (subtly) blurred.

Unfortunately, it doesn’t strike me as a good visual metaphor; it’s interesting, nonetheless.

Upshot

Vertical centering is harder than it should be; you have to manually calculate/guesstimate heights and centerings. If you’ve got a better technique, please let me know.

Disclaimer

I should note that I haven’t tested this on the iPhone itself, only on the simulator, which isn’t always 100% faithful to the hardware. I’m certainly not inclined to pursue the matter, however; it seems to me that once a feature begins to get squirrelly, it rarely improves.

Share and Enjoy:
  • Twitter
  • Facebook
  • Digg
  • Reddit
  • HackerNews
  • del.icio.us
  • Google Bookmarks
  • Slashdot
This entry was posted in iPhone. Bookmark the permalink.

Comments are closed.