动画适用于iphone但不适用于ipad

时间:2014-08-27 14:53:04

标签: ios objective-c iphone ipad

我正在使用此代码动画按钮以不同的延迟反弹:

- (void) animateWithDuration: (float) duration andObject: (UIButton *) buttonToAnimate{
buttonToAnimate.hidden = YES;

dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, duration * NSEC_PER_SEC);
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
    [self animateButton: buttonToAnimate];
});
}

- (void) animateButtons
{

[self animateWithDuration:0.3 andObject:self.photoAlbum];
[self animateWithDuration:0.7 andObject:self.camera];
[self animateWithDuration: 0.45 andObject:self.helpInfo];
}

- (void) animateButton: (UIButton *) button
{
button.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.001, 0.001);
button.hidden = NO;

[UIView animateWithDuration:0.3/0.7 animations:^{
    button.transform = CGAffineTransformScale(CGAffineTransformIdentity, 1.1, 1.1);
} completion:^(BOOL finished) {
    [UIView animateWithDuration:0.3/1.0 animations:^{
        button.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.9, 0.9);
    } completion:^(BOOL finished) {
        [UIView animateWithDuration:0.3/1.0 animations:^{
            button.transform = CGAffineTransformIdentity;
        }];
    }];
}];
}

它在iphone上完美运行,但在ipad(模拟器)上,按钮向左跳跃一点,在完成块上大约有20个点。然后在第二次完成时返回20点。使用选项:动画上的UIViewAnimationOptionTransitionNone(或任何选项)可以减少跳跃,但您仍然可以看到它。任何想法都错了吗?

0 个答案:

没有答案
相关问题