如何更改IMKTextInput的标记文本格式?

时间:2011-06-24 08:56:01

标签: cocoa input-method-kit

默认情况下,IMKTextInput协议的实现者会显示当前输入会话的标记文本带下划线(根据文档,带有2像素黑色下划线)。我开发了特定的输入法,并希望使用其他格式,例如,没有下划线但具有背景颜色。我尝试使用空格式的字符串:

NSString *buffer = /* getting some buffered text */;
NSMutableAttributedString *text = [[[NSMutableAttributedString alloc] initWithString:buffer attributes:[NSDictionary dictionary]] autorelease];
// client is of type id<IMKTextInput>, of course
[client setMarkedText:text selectionRange:NSMakeRange(0, [text length]) replacementRange:NSMakeRange(NSNotFound, NSNotFound)];

但无济于事。那么,我该如何更改标记文本的格式呢?有可能吗?

0 个答案:

没有答案
相关问题