문제

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?

도움이 되었습니까?

해결책

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.

다른 팁

import Cocoa

class TranslucentView: NSView {

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

    }

}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top