11
Bir ses klibi akışı sırasında UIProgressBar
içinde UITableviewCell
görüntülenmesi gereken bir gereksinim var.UITroViewBar'ı UITableViewCell'e ekle
Bir NSTimer
çalıştırmayı denedim ve ardından ilerleme görünümünü güncellemeye çalıştım ancak çalışmaz. Bu benim kodum. Lütfen bu yaklaşımda neyin yanlış olduğunu bana bildirin.
cellForRowAtIndexPath
fCell.progressPlay.alpha = 0.5;
fCell.progressPlay.tintColor = navigationBarColor;
[fCell.progressPlay setTransform:CGAffineTransformMakeScale(fCell.frame.size.width, fCell.frame.size.height)];
[fCell.progressPlay setHidden:NO];
return fCell;
- (void)updatePlayProgress {
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
NSLog(@"Duration %f", appDelegate.moviePlayer.duration);
NSLog(@"Current time %f", appDelegate.moviePlayer.currentPlaybackTime);
float timeLeft = appDelegate.moviePlayer.currentPlaybackTime/appDelegate.moviePlayer.duration;
// upate the UIProgress
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:playingIndex inSection:0];
FeedCell *cell = (FeedCell*)[self tableView:self.tblView cellForRowAtIndexPath:indexPath];
NSLog(@"Time left %f", timeLeft);
cell.progressPlay.progress = 0.5;
[cell.progressPlay setNeedsDisplay];
}
TableviewCell yılında, saat ve alarm
self.timer = [NSTimer scheduledTimerWithTimeInterval:0.25
target:self
selector:@selector(updatePlayProgress)
userInfo:nil
repeats:YES];
Güncelleme UIProgressView çalıştırın Eğer aşağıdaki satırın fCell.progressPlay.progress = 0.0
yılında 0.0
geri ilerleme çubuğu ayarlarken [self.tblView reloadData]
çağırdığınızdaÇıktı Bu
deneyin bulundu UIViewController'ınızda bir iVar olarak, ilerlemenin sıfırlandığını ya da t değeri kalıcı değil. – Jasper