My app has a preferences window with a toolbar. Its preferences tab is a separate NSView object. When I put standard buttons, boxes, etc. in each view, switching between tabs work wonderfully, but when I add custom boxes or views, the custom objects become invisible after switching between tabs.
How do I fix this?
Notice that I use method drawLayer: in each custom object. I mark the "layer" checkbox in IB for the superview.
You shoudn't use the implicit layer on a layer-backed view to do custom drawing. Although this sometimes works, it is not supported.
Instead, you should create your own
CALayerobject and add it to the view's implicit layer using[self.layer addSublayer:yourCustomLayer]. You would then set your object as the layer's delegate and implementdrawLayer:inContext:to do your custom drawing.