将 NSProgressIndicator 添加到停靠栏图标
我正在创建一个应用程序,它应该在停靠图标中显示进度条。目前我有这个,但它不起作用:
NSProgressIndicator *progressIndicator = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect(0.0f, 0.0f, 10.0f, 20.0f)];
[progressIndicator setStyle:NSProgressIndicatorBarStyle];
[progressIndicator setIndeterminate:NO];
[[[[NSApplication sharedApplication] dockTile] contentView] addSubview:progressIndicator];
[progressIndicator release];
或者我必须自己在码头上画它?有人可以帮助我吗?谢谢。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最后我不得不使用以下代码,因为 contentView 为空:
In the finish I had to use the following code as the contentView was null:
刚刚玩了一下 DockTile 示例代码: http://developer.apple.com/library/mac/#samplecode/DockTile/Introduction/Intro.html#//apple_ref/doc/uid/DTS10004391
我设法得到了通过在 initWithFrame 中添加到 SpeedometerView.m 来显示 NSProgress 栏
,但它在扩展坞中仍然呈灰色。
我还找到了此页面: http:// /osx.hyperjeff.net/Apps/apps?p=4&sub=22&l=1&u=on 其中有“PMProgressIndicator”可能会有所帮助,但我没有深入研究它。
希望对您有所帮助,如果您弄清楚了,请回到这里,我也有兴趣知道。
Just had a play around with the DockTile sample code: http://developer.apple.com/library/mac/#samplecode/DockTile/Introduction/Intro.html#//apple_ref/doc/uid/DTS10004391
I managed to get an NSProgress bar to display there by adding
to SpeedometerView.m in initWithFrame, but it was still greyed out in the dock.
I also found this page: http://osx.hyperjeff.net/Apps/apps?p=4&sub=22&l=1&u=on which has "PMProgressIndicator" which might help, but I didn't dive through it.
Hope that helps a bit, post back on here if you figure it out, I'd be interested to know as well.