Here i want to create a custom uislider which is similar to media player forward and backward ie programatically moving slider at a particular time interval.
for example consider am having a video for this video i need to implement slider to controller to move forw开发者_运维百科ard and backward of video content.
any samples and tutorials.
thanks....
Here is a code which will work as a progress bar like moviePlayerController
I Hope This code will help you
// .M 
@property (nonatomic,strong)UISlider *slider1;
- (void)viewDidLoad
{
    [super viewDidLoad];
    slider1 = [[UISlider alloc] initWithFrame:CGRectMake(10, 400, 300,30)];
    [slider1 setBackgroundColor:[UIColor clearColor]];
    slider1.maximumValue =  1.0;
    slider1.minimumValue = 0.0;
    slider1.continuous = YES;
    [NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(updateSlider1) userInfo:nil repeats:YES];
    [slider1 addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventValueChanged];
    [self.view addSubview:slider1];
    [self.view bringSubviewToFront:slider1];
}
// this method seek video
-(void)sliderAction:(id)sender
{
    float currentValue,TotalValue;
    float value;
    currentValue = self.moviePlayerController.currentPlaybackTime;
    TotalValue = self.moviePlayerController.duration;
    value =self.moviePlayerController.currentPlaybackTime = slider1.value * TotalValue;
}
// Update slider value after each 0.2 sec 
- (void)updateSlider1 {
    float currentValue,TotalValue;
    float value;
    currentValue = self.moviePlayerController.currentPlaybackTime;
    TotalValue = self.moviePlayerController.duration;
   value = (currentValue/TotalValue);
    slider1.value = value;
}
This might be of interest to you;
UISlider with ProgressView combined
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论