gpt4 book ai didi

ios - 来电消失查看事件

转载 作者:行者123 更新时间:2023-11-30 13:41:48 27 4
gpt4 key购买 nike

我里面有一个ContainerViewViewController。然后,当用户单击按钮时,我隐藏此 ContainerView (myContainerView.hidden = true),但 ViewController 继续工作,导致卡住。我如何隐藏 ContainerViewstop ViewController 内部,以触发 viewWillDisappear 方法。我不需要每次都杀掉它。

当您更改选项卡时,UITabBarController 具有相同的行为,它只会停止 Controller 。

enter image description here

最佳答案

Calling the standard function removeFromParentViewController we remove the current Detail Controller from the Container hierarchy. When this function is called, the function didMoveToParentViewController is automatically called with nil as parameter on the Detail Controller.

再次添加

- (void)presentDetailController:(UIViewController*)detailVC{

//0. Remove the current Detail View Controller showed
if(self.currentDetailViewController){
[self removeCurrentDetailViewController];
}

//1. Add the detail controller as child of the container
[self addChildViewController:detailVC];

//2. Define the detail controller's view size
detailVC.view.frame = [self frameForDetailController];

//3. Add the Detail controller's view to the Container's detail view and save a reference to the detail View Controller
[self.detailView addSubview:detailVC.view];
self.currentDetailViewController = detailVC;

//4. Complete the add flow calling the function didMoveToParentViewController
[detailVC didMoveToParentViewController:self];

}

关于ios - 来电消失查看事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35481906/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com