iOS使用彩色动画按钮单击不工作

iOS使用彩色动画按钮单击不工作,ios,objective-c,animation,Ios,Objective C,Animation,我有一个关于Objective-c中iOS的问题 我尝试添加背景色动画 动画工作正常,但未调用我的按钮操作 如何解决这个问题?多谢各位 - (void)viewDidLoad { [super viewDidLoad]; [self.view setBackgroundColor:[UIColor colorWithRed:0.89 green:0.10 blue:0.220 alpha:1.000]]; [UIView animateKeyframesWi

我有一个关于Objective-c中iOS的问题

我尝试添加背景色动画

动画工作正常,但未调用我的按钮操作

如何解决这个问题?多谢各位

 - (void)viewDidLoad {
      [super viewDidLoad];
      [self.view setBackgroundColor:[UIColor colorWithRed:0.89 green:0.10 blue:0.220 alpha:1.000]];
      [UIView animateKeyframesWithDuration:3.0 delay:0.0 options:UIViewKeyframeAnimationOptionAutoreverse | UIViewKeyframeAnimationOptionRepeat animations:^{
          [self.view setBackgroundColor:[UIColor colorWithRed:148/255.0 green:28/255.0 blue:81/255.0 alpha:1]];
      } completion:nil];

 }


 - (IBAction)btnPressed:(UIButton *)sender {
     NSLog(@"button click action");
 }

添加
uiviewKeyframeAnimation选项LowUserInteraction
以允许用户在动画期间进行交互:

 [UIView animateKeyframesWithDuration:3.0 delay:0.0 options:UIViewKeyframeAnimationOptionAutoreverse | UIViewKeyframeAnimationOptionRepeat | UIViewKeyframeAnimationOptionAllowUserInteraction animations:^{
     [self.view setBackgroundColor:[UIColor colorWithRed:148/255.0 green:28/255.0 blue:81/255.0 alpha:1]];
 } completion:nil];

你的问题无法理解,我需要在背景中重复实现颜色变化,但当我添加代码时,我的按钮操作不起作用。非常感谢!!当我添加“UIViewKeyframeAnimationOptionAllowUserInteraction”键时,它可以工作。