我有一个由四个轨道组成的队列。当轨道改变时,我想改变一个 UIImage,关于那个特定的轨道(如果轨道 1 正在播放我想显示一个标题为 1.png 的图像,如果轨道 2 正在播放我想显示 2.png 等) .
我想使用 switch 语句,但我不确定在设置表达式时如何使用它。
switch(soundEmotions AVPlayerItem)
{
case yellowVoice:
UIImage * yellowImage = [UIImage imageNamed:@"yellow.png"];
[UIView transitionWithView:self.view
duration:1.0f
options:UIViewAnimationOptionTransitionCrossDissolve
animations:^{
mainImage.image = yellowImage;
} completion:NULL];
break;
case orangeVoice:
UIImage * orangeImage = [UIImage imageNamed:@"orange.png"];
[UIView transitionWithView:self.view
duration:1.0f
options:UIViewAnimationOptionTransitionCrossDissolve
animations:^{
mainImage.image = orangeImage;
} completion:NULL];
break;
case redVoice:
break;
case pinkVoice:
break;
default:
break;
}