NSButton 位于 NSTextField 内
我正在尝试创建一个 NSTextField,其右侧有一个按钮(类似于 NSSearchView),但我不知道如何让 NSTextField 的文本滚动而不进入 NSButton 下方。
到目前为止,这是我的代码:
rightButton = [[NSButton alloc] initWithFrame:rect];
[rightButton setTarget:self];
[[rightButton cell] setHighlightsBy:NSNullCellType];
[rightButton setImage:[NSImage imageNamed:@"rightButton"]];
[rightButton setAction:@selector(action:)];
[rightButton setBordered:NO];
有什么想法吗?
编辑:这是问题的屏幕截图。
I'm trying to create a NSTextField with a button on its right side (similar to a NSSearchView), but I can't figure out how to have the NSTextField's text scroll without going under the NSButton.
Here is my code thus far:
rightButton = [[NSButton alloc] initWithFrame:rect];
[rightButton setTarget:self];
[[rightButton cell] setHighlightsBy:NSNullCellType];
[rightButton setImage:[NSImage imageNamed:@"rightButton"]];
[rightButton setAction:@selector(action:)];
[rightButton setBordered:NO];
Any thoughts?
EDIT: Here is a screenshot of the problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这就是这样你正在寻找。基本上,您所做的就是调整框架以补偿您放置在字段内的按钮。
I think this is what you're looking for. Basically what you're doing is adjusting the frame to compensate for the button you put inside the field.