【发布时间】:2015-02-18 14:12:20
【问题描述】:
我有一个子类 NSBox。在里面我嵌入了一些 NSTextfields,它们在它们的角落显示了一些奇怪的伪影(参见image here)。这是我的 NSBox 子类代码:
- (void)drawRect:(NSRect)rect {
NSBezierPath* rectanglePath = [NSBezierPath bezierPathWithRoundedRect:rect
xRadius: 4
yRadius: 4];
[NSColor whiteColor];
[rectanglePath fill];
}
有什么想法吗? 谢谢,托马斯
【问题讨论】:
-
如果要向其中添加 TextFields,为什么要使用 NSBox?过了一点,只使用 NSView 似乎更有意义。
-
stevesliva,我删除了 NSBox 并将其替换为子类 NSView。结果相同。但是当我在 View Effects Inspector 中检查 Core Animation Layer 时,这些绘图问题就消失了。我不明白这里发生了什么。
-
我会更新您的标题和标签...您可能会通过 Core Animation 查询获得更多响应。
-
Sheen,这没有帮助。文物还在。
标签: objective-c cocoa user-interface nstextfield nsbox