1

アプリケーションで次のコードを使用して、UISliderでの現在の再生時間と合計時間を取得したいのですが、このリンクからコードを取得します。

   -(IBAction)sliding:(id)sender{

    CMTime newTime = CMTimeMakeWithSeconds(seeker.value, 1);
    [self.player seekToTime:newTime];
 }

-(void)setSlider{

    sliderTimer = [[NSTimer scheduledTimerWithTimeInterval:1.0 target:self    selector:@selector(updateSlider) userInfo:nil repeats:YES]retain];
    self.seeker.maximumValue = [self durationInSeconds];
    [seeker addTarget:self action:@selector(sliding:) forControlEvents:UIControlEventValueChanged];
    seeker.minimumValue = 0.0;
    seeker.continuous = YES;  
}

- (void)updateSlider {

    self.seeker.maximumValue = [self durationInSeconds];
    self.seeker.value = [self currentTimeInSeconds];
}

- (Float64)durationInSeconds {
        Float64 dur = CMTimeGetSeconds(duration);
    return dur;
}


- (Float64)currentTimeInSeconds {
        Float64 dur = CMTimeGetSeconds([self.player currentTime]);
    return dur;
  }

しかし、私はシーカーが何であるかわかりません。私はiOSを初めて使用するので、この問題のチュートリアルに関する提案が必要です。

4

2 に答える 2

2
@property (strong, nonatomic) IBOutlet UISlider *seeker;
于 2013-01-28T11:43:16.613 に答える
0

@ Mr.Bond

- (Float64)currentTimeInSeconds {

double runningTime = CMTimeGetSeconds(_playerViewController.player.currentTime);
NSLog(@"currentTime %f",runningTime);

return dur;
}
于 2016-10-12T06:38:54.617 に答える