NOCircleSelector icon indicating copy to clipboard operation
NOCircleSelector copied to clipboard

Jump from endDot to startDot when holding touch

Open BoilingLime opened this issue 10 years ago • 6 comments

I guess this is not a real issue, but is there any way to avoid this comportment. It would be great to have a BOOL property to set in the CircleSelector to avoid to jump from endpoint to startpoint when user hold finger pressed and go from end to start.

If you have any tricks, let me know.

BoilingLime avatar Oct 22 '14 16:10 BoilingLime

Sure ^^ Will add this feature in next version (this or next weekend).

natalia-osa avatar Oct 22 '14 19:10 natalia-osa

Thanks, great work any way, this is awesome. And one more thing. Is there a simple way to move programatically a dot ? I'm actually using it as a slider at the same time as a progress bar for audio duration. So I would like to move dot while the audio is playing in an updating methods. I'm trying to directly set the NOCircleDot angle property, but does't seem to refresh the UI.

BoilingLime avatar Oct 23 '14 11:10 BoilingLime

Thank you so much^^. To move a dot via code you need to find the correct dot and setAngle:. You can calculate the angle with method: angleForValue:maxAngle:maxValue:minAngle:minValue:. Then you need to redraw NOCircleSelector.

Still, such use of the method is not animated ;). If you want animations I can add them too, that's a good idea. Will also add it in next version.

natalia-osa avatar Oct 23 '14 11:10 natalia-osa

This is what I'm doing, for the first part.

    NOCircleDot *dot = ((NOCircleDot *)[[circleSelector dots] objectAtIndex:1]);

    dot.angle =
    [NOCircleDot angleForValue:audioPlayer.progress maxAngle:dot.maxAngle
                      maxValue:audioPlayer.duration minAngle:kbigMinAngle minValue:0.0];
    [dot.textLabel setText:[NSString stringWithFormat:@"%@", [Utils convertSecond:
                                                              [NOCircleDot valueForAngle:dot.angle maxAngle:kbigMaxAngle maxValue:audioPlayer.duration minAngle:kbigMinAngle minValue:0.f]]]];

But I'm not sure how to redraw the NOCircleSelector properly, since there is not public methods to do it.

BoilingLime avatar Oct 23 '14 11:10 BoilingLime

Very well, then you only need to call this after your code:

[cicleSelector setNeedsDisplay];

This will call delegate method circleSelector:updatedDot:, so if you have your text handler there it will change the text and you can delete it here.

natalia-osa avatar Oct 23 '14 11:10 natalia-osa

Oh my bad I was calling setNeedsDisplay on NOCircleDot -_- ! Great it works, as you said, the animation would be a nice enhancement. I'll wait for it :). Thanks for your help, and for your work.

BoilingLime avatar Oct 23 '14 11:10 BoilingLime