改变动画UIButton的背景

时间:2014-10-31 00:55:06

标签: ios objective-c animation uibutton

我有UIButton使用UIView animateWithDuration将其翻译到屏幕上。当按下UIButton时,它会被隐藏。但[self.squareOne setHidden:NO];是方法的开头,使其重新出现。完成块:

completion:^(BOOL complete) {
                         if (complete) {
                             if (self.squareOne.hidden==YES) {
                                 [self squareOneMover]; //squareOneMover is the method the animation is created
                             }
                         }
                     }

只要按下UIButton,动画就会重复播放,但出于某些原因,我在[self squareOneMover]之前添加此动画时出现了:

[self squareOneColour];

完成不会发生,因此循环停止。 squareOneColour

- (void) squareOneColour {
    NSUInteger r = arc4random_uniform(5);
    [self.squareOne setBackgroundImage:[self.colorImageArray objectAtIndex:r] forState:UIControlStateNormal];
}

我想要的是squareOne背景更改,以便在下一个动画中它看起来不同。我该怎么做?

0 个答案:

没有答案
相关问题