Show Unicode characters in text field
I have a slider for testing and I want the characters represented by the slider position to be shown in a text field. But my text field only shows AZ and az when running my solution below. How can I get Unicode characters into my text field?
- (IBAction) doSlider: (id) sender
{
long long theNum = [sender intValue];
NSString *vc_theString = [NSString stringWithFormat:@"%c", theNum];
[charField setStringValue:vc_theString2];
}
%c
is inherited from C and limited to an 8-bit range. You should use %C
, which will read in the corresponding argument as a unichar
.
上一篇: 使用绑定和格式化程序驯服NSTextField以正确运行
下一篇: 在文本字段中显示Unicode字符