
见图:http://osxdaily.com/wp-content/uploads/2011/04/mac-os-x-lion-terminal.jpg
我一直在谷歌搜索一个小时,无法得到任何工作.我相信我需要以某种方式创建一个核心动画层并添加一个背景过滤器,但到目前为止我还没有成功……我只看到了窗口的灰色背景.这是我到目前为止的代码:
码:
// Get the content vIEw -- everything but the Titlebar.NSVIEw *theVIEw = [[self window] contentVIEw];[theVIEw setAlphaValue:0.5];// Create core animation layer,with filterCALayer *backgroundLayer = [CALayer layer];[theVIEw setWantsLayer:YES];[theVIEw setLayer:backgroundLayer]; CIFilter *blurFilter = [CIFilter filterWithname:@"CIGaussianBlur"];[blurFilter setDefaults];[theVIEw layer].backgroundFilters = [NSArray arrayWithObject:blurFilter]; [[theVIEw layer] setBackgroundFilters:[NSArray arrayWithObject:blurFilter]];
有什么提示或例子可以做我想做的事情吗?
谢谢!
[mywindow setopaque:NO];[mywindow setBackgroundcolor: [NScolor colorWithCalibratedHue:0.0 saturation:0.0 brightness:0.2 Alpha:0.5]];
请不要使用它,因为它也会标题为你的标题栏(在这里发布以防其他人需要)
[mywindow setopaque:NO];[mywindow setBackgroundcolor: [NScolor blackcolor]];[mywindow setAlphaValue:0.5];总结
以上是内存溢出为你收集整理的macos – 如何获得半透明模糊背景的窗口全部内容,希望文章能够帮你解决macos – 如何获得半透明模糊背景的窗口所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)