So i'm wondering what is the differnce between these two messages and why are they needed both since their result is the same.
They're not the same. Look at the documentation for the opaque
property: It's how you tell NSView that you're going to draw in your entire bounds, completely covering anything below your view. If this isn't true (if you don't cover the entire bounds, or you don't always draw at 100% opacity), then your view is not opaque, and you should leave that property set to NO
.
If you set your view's background color to clearColor
(which is simply a color with 0% opacity), and don't draw at 100% opacity over the entire background, then your view is not opaque. On the other hand, it is possible to have clearColor
as your background and then completely draw over it, in which case your view is opaque and should set itself as such.