views:

123

answers:

3

This picture shows what i want , i just making a custom movieplay controller.

alt text

I know how to make a custom uislider as code below

    playSlider.backgroundColor=[UIColor clearColor];
    [playSlider setThumbImage:[UIImage imageNamed:@"sliderButton.png"] forState:UIControlStateNormal];
    [playSlider setMaximumTrackImage:[UIImage imageNamed:@"sliderGray.png"] forState:UIControlStateNormal];
    [playSlider setMinimumTrackImage:[UIImage imageNamed:@"sliderBlue.png"] forState:UIControlStateNormal];

but that can not help me .Is there any ideas? Thank you for any advices!

A: 

You should be able to subclass drawRect on the UISlider to customize that, but I may be wrong.

Joshua Weinberg
thank you ~but PM ask me to do like that.
ben
A: 

overriding drawRect: is not a good idea. You will have to make a custom object containing something like: an UIButton for the play/pause, an UISlider for the slider, an UIButtons for the mute on/off, and a UIView for the volume (you will have to implement by your self)

Actually is not difficult, is just an container object.

nacho4d
Yes ,i have done what you say ,i think you shoud see the uislider,the track has run over of the indicator.I feel that is the importance.
ben
+2  A: 

I think you could get away with a UISlider only if the thumb was never allowed to leave the blue (loaded) area. Then you could draw the inactive (unloaded) track to the right of the actual slider bounds, and just update the bounds for the slider as the video loads, which would increase the blue area. But you'd still have to do the right math for the slider thumb's relative progress.

If you need the thumb to swipe into the unloaded area, or you want to avoid a headache with the recalculation, you should just build your own control. Unfortunately, the UISlider is not a highly customizable control by itself.

quixoto
+1 I really like this idea. The relative progress should also be pretty trivial.
Dave DeLong
that's good,thank you
ben