how to get characters with accent from NSEvent

对着背影说爱祢 提交于 2019-12-25 03:56:24

问题


When I press ^ or ` and then a or e I get only a or e instead of â or é.

This is my code:

- (void) keyDown:(NSEvent*)event
{
  NSString* str = [event characters];
}

How do I solve this?


回答1:


keyDown: only gives the characters for the key you currently are pressing down. Characters that take more than one keystroke show up as a separate keyDown: call for each keystroke. If you want to see typed characters instead of individual keypresses, override -insertText: instead.



来源:https://stackoverflow.com/questions/7100131/how-to-get-characters-with-accent-from-nsevent

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