Pergunta

The result I want is:

enter image description here

I tried to set the background color of that "white transparent view" to white with a alpha about 0.5f. But the result I got is:

enter image description here

Can somebody tell me how to do it?

Foi útil?

Solução

After several days of research I figure it out that development in Mac OS is different from iOS. That is I can't accomplish this by using a semitransparent view. I need to use a whole background image. And I can what I want by doing it on the image I use! It's indeed a little to me.

Outras dicas

import Cocoa

class TranslucentView: NSView {

    override func awakeFromNib() {
        self.wantsLayer = true
        self.layer?.backgroundColor = CGColorCreateGenericRGB(0, 0, 0, 0.1)

    }

}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top