views:

38

answers:

1

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.

+2  A: 

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.

Marc Charbonneau
the view isn't nil before I call `removeFromSuperview` but after I call remove then it is null, but the view itself isn't getting removed
Matt S.
Matt S.: Check `view` (the superview). It probably is `nil`.
Peter Hosey