gpt4 book ai didi

cocoa - 如何将 NSProgressIndicator 旋转 90 度

转载 作者:行者123 更新时间:2023-12-03 16:15:21 29 4
gpt4 key购买 nike

我需要将 NSProgressIndicator 旋转 90 度。 enter image description here

当我使用以下代码时:

[self.progressIndicator1 setWantsLayer:NO];
[self.progressIndicator1 setFrameCenterRotation:90];
[self.progressIndicator1 setMinValue:0];
[self.progressIndicator1 setMaxValue:100];
[self.progressIndicator1 setDoubleValue:50];
[self.progressIndicator1 displayIfNeeded];

[self.progressIndicator2 setWantsLayer:NO];
[self.progressIndicator2 setFrameCenterRotation:90];
[self.progressIndicator2 displayIfNeeded];

我得到了不适当的结果: enter image description here

此代码在 OS X Yosemite 上运行良好,但在 OS X El Capitan 上不起作用。

我该如何修复它?

最佳答案

如果您的进度指示器包含在 View 中,那么如果您可以允许该 View 使用wansLayer,您的代码将起作用。

self.view.wantsLayer = YES;
self.progressBar1.doubleValue = 60.0;
self.progressBar2.doubleValue = 60.0;

[self.progressBar1 setWantsLayer:NO];
[self.progressBar1 setFrameCenterRotation:90];

[self.progressBar2 setWantsLayer:NO];
[self.progressBar2 setFrameCenterRotation:90];
[self.progressBar2 displayIfNeeded];

这对我在 El Capitan 上有用。

关于cocoa - 如何将 NSProgressIndicator 旋转 90 度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33035788/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com