gpt4 book ai didi

objective-c - NSTextField - 如何更改文本/编辑区域的大小和位置?

转载 作者:搜寻专家 更新时间:2023-10-30 20:03:12 24 4
gpt4 key购买 nike

嗯,我知道了:http://d.pr/i/jItM

我显然想将文本向下移动并远离左边缘。我有 NSTextField 的子类,我在其中绘制背景,但我无法找到它。

最佳答案

明白了。两者都需要被覆盖。

- (void)editWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject event:(NSEvent *)theEvent
{
aRect.origin.y += 9;
aRect.origin.x += 10;
[super editWithFrame:aRect inView:controlView editor:textObj delegate:anObject event:theEvent];
}

- (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject start:(NSInteger)selStart length:(NSInteger)selLength
{
aRect.origin.y += 9;
aRect.origin.x += 10;
[super selectWithFrame:aRect inView:controlView editor:textObj delegate:anObject start:selStart length:selLength];
}

关于objective-c - NSTextField - 如何更改文本/编辑区域的大小和位置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13440146/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com