2012-06-24 17 views
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。如何解決它?

回答

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]; 
+0

但爲什麼我的viewStart在我的viewMain結束翻轉後出現?有點奇怪 – Piyo