看板 MacDev 關於我們 聯絡資訊
※ 引述《haman (...)》之銘言: : 不好意思 : 想請問一個關於Animation的問題 : 我在主要的ViewController A中使用 : [UIView beginAnimations: @"View Flip" context: nil]; : [UIView setAnimationDuration: 1.0f]; : [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut]; : [UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView: self.view cache: YES]; : mySaveViewController = [[SaveViewController alloc] init]; : [self.view addSubview: mySaveViewController.view]; : [UIView commitAnimations]; : 而進到了下一個UIViesController B 這邊是把mySaveViewController.view當成目前的self.view的subView, 其它的UIView的static method是為了動畫效果, 但是這邊顯示的方式,是在self.view上面加了一個subView, 並且蓋過self.view。 : 但是我想要從B回到A時 使用了 : [UIView beginAnimations: @"View Flip" context: nil]; : [UIView setAnimationDuration: 1.0f]; : [UIView setAnimationCurve: UIViewAnimationCurveEaseInOut]; : [UIView setAnimationTransition: UIViewAnimationTransitionFlipFromRight forView: self.view cache: YES]; : [self.view removeFromSuperview]; 既然是要回到原本的self.view的效果, 想當然的,應該是把self.view上的subView給移掉。 不過我看過的範例是,在self這個controller裡, maintain另外兩個controller的view, 隨著需要,替換到self.view上的sub view。 像是要顯示A 的畫面的話,就是 [B.view removeFromSuperview]; [self.view addSubView:A.view]; 顯示B 的畫面的話,就是 [A.view removeFromSupuerview]; [self.view addSubView:B.view]; : [UIView commitAnimations]; : 卻沒有出現翻頁的動畫效果 : 想請問一下該如何解決這個問題] : 謝謝 -- 格局決定了結局 個性決定了命運 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.216.233.223
haman:所以意思是說 當我用了 01/20 06:18
haman:[self.view addSubview: mySaveViewController.view]; 之後 01/20 06:19
haman:我的self.view還是原來的SaveViewController.view嗎??? 01/20 06:19
haman:喔不好意思講錯... 01/20 06:20
haman:應該說那段程式之後 我的self.view還是原來的self.veiw 01/20 06:20
haman:而不是mySaveViewController.view 是這樣子嗎??? 01/20 06:21
haman:還有想問的是 為什麼這邊使用exchangeSubview時 不管index用 01/20 07:07
haman:0, 1, 2 結果都只是同一個畫面在轉而已... @ @" 01/20 07:07