سؤال

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