【发布时间】:2012-05-25 21:11:45
【问题描述】:
我正在使用 inputmethodkit 并尝试在某些文本下方放置一个窗口。
_currentClient 是一个IMKTextInput 实例
candidates 是 IMKCandidates 实例
// Get the current location to place the window
NSRect tempRect = NSMakeRect(0, 0, 0, 0);
NSDictionary* clientData = [_currentClient attributesForCharacterIndex:0 lineHeightRectangle:&tempRect];
NSPoint* windowInsertionPoint = (NSPoint*)[clientData objectForKey:@"IMKBaseline"];
...
[candidates setCandidateFrameTopLeft:*windowInsertionPoint];
[candidates showCandidates];
现在,我知道windowInsertionPoint 变量很好,当我调试时我可以看到它的值,例如:NSPoint: {647,365}
但是,当我使用它时,候选窗口只显示在屏幕的左下角。我以前没有处理过屏幕放置问题,因此非常感谢您的帮助。
如果我将任意静态值传递给setCandidateFrameTopLeft,它将被放置在屏幕中。以下作品:
[candidates setCandidateFrameTopLeft:NSMakePoint(401, 354)];
是指针问题吗?
【问题讨论】:
标签: objective-c pointers input-method-kit