1
我正在嘗試一個多視圖應用程序,但我似乎無法得到第一個視圖控制器消失,當我把新的視圖控制器。我在索引0處放置第二個(即將到來的)視圖控制器,並將它放置在背景中。我認爲[going.view removeFromSuperview]將刪除原視圖 - 控制,但是這不是發生了什麼......讓一個視圖控制器消失
UIViewController *coming = nil;
UIViewController *going = nil;
UIViewAnimationTransition transition;
if (answer == YES)
{
coming = boyController;
going = getInfoController;
transition = UIViewAnimationTransitionFlipFromLeft;
}
else
{
coming = girlController;
going = getInfoController;
transition = UIViewAnimationTransitionFlipFromLeft;
}
NSLog(child);
[UIView setAnimationTransition:transition forView: self.view cache:YES];
[coming viewWillAppear:YES];
[going viewWillDisappear:YES];
[going.view removeFromSuperview];
[self.view insertSubview:coming.view atIndex:0];
[going viewDidDisappear:YES];
[coming viewDidAppear:YES];
[UIView commitAnimations];