我有一个名为 mapWindow 的类,它连接到 IB 中的一个窗口。
无论如何,除非代码在 drawRect 下或我移动窗口边框,否则我希望程序渲染的红色圆圈不会出现。甚至解锁和锁定焦点都不会更新窗口。
theOtherWindowView 实际上是一个连接到 IB 中的自定义视图的 NSView。
- (void)test
{
[theOtherWindowView lockFocus];
NSBezierPath *path = [NSBezierPath bezierPath];
NSPoint center = [self drawPoint];
[path moveToPoint: center];
[path appendBezierPathWithArcWithCenter:center
radius:explosionRadius
startAngle:0
endAngle:360];
[[NSColor redColor] set];
[path fill];
[theOtherWindowView unlockFocus];
}
我不想使用 drawRect 因为我想要多个实例而不是一个形状,它的坐标每次更新都会改变。
我也试过[self lockFocus]
了[mapWindow lockFous]