у меня есть функция
-(void)setCurrentDuration:(double)currentTime
{
[self.slider setValue:currentTime animated:YES];
}
в ячейке UIPhilosophyViewCell.
вызов
for (UIPhilosophyViewCell* cell in [self.customTableView visibleCells])
{
if ([cell isKindOfClass:[UIPhilosophyViewCell class]])
{
if ([TRIM(cell.dicData[@"id"]) isEqualToString:self.currentPlayingID])
{
[cell.audioProgressViewController setCurrentDuration:[self.audioPlayer currentTime]];
}
}
}
анимирует изменение значения ползунка, но setCurrentDuration, вызываемый из селектора наблюдателя уведомлений, этого не делает. Любые предложения о том, что может быть проблемой?
добавление ячейки в центр уведомлений
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveTestNotification:) name:@"playingProgress" object:nil];
и селектор
- (void) receiveTestNotification:(NSNotification *) notification
{
NSDictionary* data = notification.object;
if (data == nil)
{
data = [NSDictionary dictionary];
}
if ([[notification name] isEqualToString:@"playingProgress"] && [TRIM(self.dicData[@"id"]) isEqualToString:TRIM(data[@"id"])])
{
[self setCurrentDuration:[(NSNumber*)TRIM(data[@"currentDuration"]) doubleValue]];
}
else
{
[self setCurrentDuration:0];
}
}
TRIM - это функция для получения ненулевого объекта или строки