如何删除 NSBezierPath
我创建了一个 NSBezierPath
,并在其上调用了 -lines 。如何在不取消分配对象的情况下从视图中删除/删除它?
I have an NSBezierPath
that I created and I called -stroke on it. How do I remove/delete it from the view without deallocating the object?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
-lines
消息告诉NSBezierPath
在当前绘图上下文中渲染自身。如果您在视图中绘制了路径,并且希望描边路径消失,则只需重新绘制不带路径的视图即可。A
-stroke
message tells theNSBezierPath
to render itself in the current drawing context. If you've drawn a path in a view, and you want the stroked path to go away, just redraw the view without the path.如果你想暂时禁用绘图,可以在调用
lines
之前设置[NSColorclearColor]
。If you want to temporary disable drawing, you can set
[NSColor clearColor]
before callingstroke
.