开发者

can i add progress into a UISlider?

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

alt text http://www.imagechicken.com/uploads/1279252703012036800.png

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:UIC开发者_运维知识库ontrolStateNormal];
    [playSlider setMinimumTrackImage:[UIImage imageNamed:@"sliderBlue.png"] forState:UIControlStateNormal];

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


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.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜