The modifier keys all have Unicode values that you can see in the "Special Characters" palette and they are displayed by the normal system font. Most of them are in the "Technical Symbols" category of the palette but the up-arrows for the Shift and Caps Lock keys are in the "Arrows" section.
You can insert these values when editing label elements in Interface Builder or Xcode, or include their corresponding Unicode values when creating something like an NSString
object.
For example, the Shift key's UTF-8 sequence (as shown in the palette) is E2 87 A7
so one way to set it programmatically is to add those bytes to an array and create an NSString
from the UTF-8 array. I prefer the array approach because it's "bulletproof"; it will always be interpreted as UTF-8 and do what you expect. If you try to insert characters directly into @""
or CFSTR()
strings, you then have to make sure your source file's encoding is correct (and older versions of Xcode wouldn't even allow this, they'd assume ASCII only).