开发者

Infinitely looping animation

I am trying to create an infinitely looping animation but am having some trouble. I am using this line of code the make my view "throb" red but when I call this line it works but make my UI unresponsive.

[UIView animateWithDuration:1.0f 
                      delay:0.0f 
                    options:(UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat) 
                 animations:^{ 
  self.backgroundColor = [UIColor colorWithRed:0.5 green:0.0 blue:0.0 alpha:1.0]; 
} 
                completion:nil];

My questions are: 1)is this the correct way to do th开发者_JAVA技巧is? 2)why does this make the UI unresponsive?


Your options need to include UIViewAnimationOptionAllowUserInteraction. By default, UIView animations disable input while they're running.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜