更改主窗口上的 Alpha - Cocoa
我想知道当我打开应用程序和关闭应用程序时是否可以缓慢增加 alpha MainWindow。我知道这可能涉及到计时器之类的东西,但我以前从未处理过这种事情。我需要你们的帮助...!
凯文
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 NSViewAnimation。尽管有这个名字,但它适用于窗口和视图。
Use NSViewAnimation. Despite the name, it works on windows as well as views.
[自我设置Alpha值:0];
这将设置窗口的 Alpha。只需创建一个 NSTimer,通过增加或减少来提高或降低 alpha 值。该值为 <#(CGFloat)windowAlpha#>。
[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#>.