Note that there are some explanatory texts on larger screens.

plurals
  1. PONSProgressIndicator not animating in layer-backed view
    primarykey
    data
    text
    <p>I have a bar-style <code>NSProgressIndicator</code> in a subview of a layer-backed view. Its behavior is sort of complicated, but at certain points, it is displayed as a bar-style indeterminate progress indicator. The problem is, when in this state, it doesn't animate (i.e. twirl the barber pole). Turning off layer backing fixes the issue, but that makes other animations the window does less smooth, so I'm hoping for something better.</p> <p>Here's the full behavior: when what amounts to a dirty flag is set, it should become visible as an indeterminate, animating progress indicator; then after a short delay (to make sure the user has finished typing) it transforms into a determinate progress indicator and fills as various operations are performed; and finally, at the end of the whole process, it hides itself once more.</p> <p>To implement this, I've set up the following bindings:</p> <ul> <li><em>Hidden</em> is bound to my model's <code>loading</code> property with an <code>NSNegateBoolean</code> value transformer.</li> <li><em>Is Indeterminate</em> is bound to my model's <code>waitingForInput</code> property.</li> <li><em>Value</em> is bound to my model's <code>currentProgress</code> property (which is 0 when <code>waitingForInput</code> is true).</li> <li><em>Max Value</em> is bound to my model's <code>maximumProgress</code> property (which is 0 when <code>waitingForInput</code> is true).</li> </ul> <p>This mostly works, but with one exception: when <code>waitingForInput</code> is <code>YES</code>, and thus the progress indicator is indeterminate, the progress indicator doesn't animate .</p> <p>The usual reason for a progress indicator to not update is that the programmer is blocking the run loop with a long-running operation, but I'm not doing that: during the period in question, the run loop is totally open, with just a timer waiting to fire. As far as I know, it's not in some odd mode, either. The app accepts keystrokes and other events during this time without any issues. (The later phase, with a determinate progress indicator filling up, is driven by an asynchronous <code>NSURLConnection</code>, so it's not blocking either.)</p> <p>I've taken several steps to try to fix this problem:</p> <ul> <li>I've tried setting the <em>Animate</em> binding on the progress indicator to my model's <code>waitingForInput</code> property, like <em>Is Indeterminate</em>. This causes the animation to update jerkily when change notifications fire on <code>waitingForInput</code> (<code>waitingForInput</code> happens to send KVO notifications every time the input delay restarts), but I'm hoping for a much smoother animation than that.</li> <li>I've tried using KVO to observe changes to both <code>loading</code> and <code>waitingForInput</code>. When a change is observed, it calls the progress indicator's <code>-startAnimation:</code> and <code>-stopAnimation:</code> methods as appropriate. These have no apparent effect.</li> <li>I've tried setting <code>usesThreadedAnimation</code> on the progress indicator to <code>NO</code>. (A hit on Google suggested this might help with updating problems on layer-backed progress indicators.) This has no apparent effect. I also tried <code>YES</code>, just for kicks, which proved equally futile.</li> </ul> <p>Finally, I've also tried turning off layer backing. This does fix the problem when combined with the Animate binding. However, it degrades the performance of other animations unacceptably, so I'd prefer to avoid doing this.</p> <p>So, any ideas, anyone? I'd really appreciate some help with this problem!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload