NSView 未从超级视图中删除
我有一个来自 NSViewController 的 NSView(我们称之为 view1)。超级视图(我们称之为 view2)位于 NSWindowController 内部。问题是,我可以将 view1 添加到 view2,但无法将其删除。
I have an NSView (we'll call it view1) that is from an NSViewController. The Super view (which we'll call view2) is located inside an NSWindowController. The problem is, I can add view1 to view2, but I can't remove it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从您的评论中,我猜测视图控制器的实例变量之一或视图本身未正确设置,因此您在 nil 上调用
removeFromSuperView
。使用调试器显式查看所涉及对象的状态。From your comment I'd guess one of your instance variables to the view controller or the view itself isn't being set correctly, so you're calling
removeFromSuperView
on nil. Use the debugger to explicitly see the state of the objects involved.