Change Alpha on Main Window - Cocoa

2019-09-05 14:29发布

I want to know if I can slowly increase the alpha MainWindow when I open the app and when I close the app. I know it may involve timers, and things like that, but I never dealt with this kind of thing before. I need your help guys...!

Kevin

2条回答
我只想做你的唯一
2楼-- · 2019-09-05 14:59

Use NSViewAnimation. Despite the name, it works on windows as well as views.

查看更多
forever°为你锁心
3楼-- · 2019-09-05 15:00

[self setAlphaValue:0];

That'll set the alpha of the window. Just create an NSTimer that either adds or subtracts to bring the alpha up or down. The Value is an <#(CGFloat)windowAlpha#>.

查看更多
登录 后发表回答