문제

I suspect that NSProgressIndicator runs smoother when its value is updated through incrementBy as compared to setDoubleValue.

Does anyone know if there's any real difference between the two methods of updating its value?

도움이 되었습니까?

해결책

I don't have any knowledge of the internals, but I would be very surprised if incrementBy were not the equivalent of

[self setDoubleValue:[self doubleValue] + delta];

Of course, since it has access to internal state, it could presumably skip all the method calls.But the act of actually rendering pixels to the screen almost certainly overpowers any minor performance difference between the two methods.

다른 팁

I suspect that NSProgressIndicator runs smoother when its value is updated through incrementBy as compared to setDoubleValue.

Makes no difference on macOS 10.14. When I set the maxValue to 1000 and then have a timer call a method every 100 ms, it looks identical, whether the method always calls [self.progress incrementBy:1] or [self.progress setDoubleValue:self.step++], with step being an instance variable of type NSUInteger that is initially zero.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top