我有一个子类NSBox。我在里面嵌入了一些NSTextfields,它在它们的角落中显示了一些奇怪的工件(参见像在这里)。这是NSBox的子类代码:
- (void)drawRect:(NSRect)rect {
NSBezierPath* rectanglePath = [NSBezierPath bezierPathWithRoundedRect:rect
xRadius: 4
yRadius: 4];
[NSColor whiteColor];
[rectanglePath fill];
}有什么想法吗?谢谢,托马斯
发布于 2015-03-06 14:31:56
解决这个问题的办法是使用自我界而不是rect论点。
- (void)drawRect:(NSRect)rect {
NSBezierPath* rectanglePath = [NSBezierPath bezierPathWithRoundedRect:[self bounds]
xRadius: 4
yRadius: 4];
[NSColor whiteColor];
[rectanglePath fill];}
https://stackoverflow.com/questions/28585708
复制相似问题