Cocoa:在 Lion 上子类化 NSProgressIndicator
我有一个问题让我发疯。我想以“Bar”形式对 NSProgressIndicator 进行子类化,以根据几个逻辑状态更改进度条的颜色。为此,我基本上像往常一样重写 -drawRect:
。然而,一件非常奇怪的事情发生在狮子身上。即使我的 -drawRect
只是通过 [super drawRect:]
调用超类的实现并且不执行任何其他操作,整个进度条也将使用所使用的样式显示在狮子之前。如果您还记得,在 Lion 中,进度条样式已从之前的玻璃样式变为更加平坦和时尚的外观。
同样,只需重写 -drawRect
只调用超类的实现即可将进度条的样式更改为 Leopard 的样式。有谁知道发生了什么以及我如何解决这个问题?
I have a problem that is driving me crazy. I want to subclass NSProgressIndicator
in its "Bar" form to change the color of the progress bar based on a couple of logic states. For that i basically override the -drawRect:
as usual. However a very strange thing happens on Lion. Even if my -drawRect
just calls the superclass' implementation via [super drawRect:]
and does nothing else at all the whole progress bar will be displayed using the style that was used before Lion. If you remember, with Lion the progress bar style has changes to a more flat and sleek look from the prior glassy one.
Again, just overriding -drawRect
to do nothing but to call the superclass' implementation changes the style of the progress bar to Leopard's. Does anyone have a slightest idea of what is going on and how i can fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
让进度指示器支持图层并应用 Core Image 滤镜来重新着色怎么样?
How about making the progress indicator layer-backed and applying a Core Image filter to recolour it?
CustomeProgressIndicator.h:
CustomProgressIndicator.m:
CustomeProgressIndicator.h:
CustomProgressIndicator.m: