0

这是我的翻转动画代码,我使用 2 个视图,即 viewMain 和 viewStart

- (IBAction)readyBtn:(id)sender {
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:1.0];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:[self view] cache:YES];
    [[self view] addSubview:viewStart];
    [UIView commitAnimations];
}

- (IBAction)startBtn:(id)sender {
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:1.0];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:[self view] cache:YES];
    [viewStart removeFromSuperview];
    [UIView commitAnimations];
}

在我运行它之后,我的 viewMain 被翻转到相同的 viewMain,它不能将翻转更改为 viewStart。如何解决?

4

1 回答 1

0
(IBAction)readyBtn:(id)sender {
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:viewMain cache:YES];
    viewStart.frame = viewMain.bounds;
    [viewMain addSubview:viewStart];
    [UIView commitAnimations];
于 2012-06-24T05:41:31.463 回答