2009-11-11 24 views

回答

2

雖然無法修改MPMoviePlayerController類,但您可以創建自己的控件來管理影片播放。 您這樣做的方式是,您創建一個水平滑塊,將其最小值設置爲0,並將最大值設置爲duration屬性。創建一個定時器來更新滑塊的當前值每秒到電影的currentPlaybackTime財產,像這樣:

sliderTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateSlider) userInfo:nil repeats:YES]; 

,並創建一個IBAction爲與滑塊互動,尋求特定的時間,你將需要添加一個監聽器你的滑塊,就像這樣:

[seeker addTarget:self action:@selector(sliding:) forControlEvents:UIControlEventValueChanged]; 

如果你願意,你甚至可以創建標籤顯示當前和剩餘時間,但是這是一個有點混亂。祝你好運。