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.
How to get a white half transparent NSView
سؤال
The result I want is:
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:
Can somebody tell me how to do it?
المحلول
نصائح أخرى
import Cocoa
class TranslucentView: NSView {
override func awakeFromNib() {
self.wantsLayer = true
self.layer?.backgroundColor = CGColorCreateGenericRGB(0, 0, 0, 0.1)
}
}
لا تنتمي إلى StackOverflow