我正在使用inputmethodkit并试图在某些文本下放置一个窗口。NSPoint和IMKCandidate窗口布局
_currentClient是IMKTextInput
实例
候选人是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)];
这是指针问题吗?