简体   繁体   English

可可:NSTextField具有自定义字体,光标不正确

[英]cocoa: NSTextField with custom font, cursor out of wack

I have an NSTextField with a custom font set up in Interface Builder. 我有一个NSTextField ,它在Interface Builder中设置了自定义字体。 When it loads, this is how it shows up: 加载时,显示方式如下:

开始

When the user starts typing, the cursor moves correctly 当用户开始输入时,光标会正确移动

第二

And then when the user deletes the text it resets to the correct original position 然后,当用户删除文本时,它将重置为正确的原始位置

第三

Any ideas why this might be happening? 任何想法为什么会发生这种情况?

尝试为文本字段及其超级视图启用CG层

.wantsLayer = YES;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM