Re: [問題] 換UIViewController時的Animation
※ 引述《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
推
01/20 06:18, , 1F
01/20 06:18, 1F
→
01/20 06:19, , 2F
01/20 06:19, 2F
→
01/20 06:19, , 3F
01/20 06:19, 3F
→
01/20 06:20, , 4F
01/20 06:20, 4F
→
01/20 06:20, , 5F
01/20 06:20, 5F
→
01/20 06:21, , 6F
01/20 06:21, 6F
推
01/20 07:07, , 7F
01/20 07:07, 7F
→
01/20 07:07, , 8F
01/20 07:07, 8F
討論串 (同標題文章)
MacDev 近期熱門文章
PTT數位生活區 即時熱門文章