smaiibnauf
smaiibnauf

Reputation: 63

weird behavior of UISlider

I have an UISLider created programmatically inside UITableViewCell. the slider control works with audio file to show the progress .. this is the creation:

    AudioSlider = [[UISlider alloc] initWithFrame:CGRectMake(78.0f, 28, 214, 10)];
    AudioSlider.maximumValue = 100.0;
    AudioSlider.minimumValue = 0.0;
    [AudioSlider setTag:5];
    [AudioSlider setValue:0.0];
    [[self contentView] addSubview:AudioSlider];

the problem is that the slider does not show the start and end values of the progress correctly !! when I set value to 0.0 :

[AudioSlider setValue:0.0];
[AudioSlider setValue:100.0];

the photo explain the problem enter image description here

I can't really find out the reason ...

Any idea ?

thanks in advance ..

Upvotes: 1

Views: 308

Answers (2)

rob mayoff
rob mayoff

Reputation: 385610

You have omitted some important code from your question. It is clear from your screen shot that you have made the slider's thumb invisible, perhaps by using a transparent image.

Normally, the slider would cover those ends, so the user wouldn't see the wrongly-colored parts of the channel. But by making the thumb invisible, you've made the ends visible.

If this is really supposed to be a slider that the user can interact with, you need to replace the minimum track image and maximum track image of the slider, or you need to use a thumb image that hides the ends.

If this isn't supposed to be a control that the user can interact with, use UIProgressView instead of UISlider.

Upvotes: 1

Fogmeister
Fogmeister

Reputation: 77641

It's in a tableView so I'd suggest that you're probably not setting it when you think you are due to cell dequeueing.

Can you show the code that creates and configures the UITableViewCells.

Upvotes: 0

Related Questions