大佬教程收集整理的这篇文章主要介绍了iphone – viewWillDisappear和viewDidDisappear永远不会被调用,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
CustomPopoverController不是UIViewController,而是有一个名为“contentViewController”的ivar,它实际上是显示的VC.
当用户点击contentViewController框架之外的任何地方时,我实现了自己的“dismissPopoverAnimated:”以解除我的自定义弹出窗口:
-(void) dismissPopoverAnimated : (BOOL) animated { // dismissalView is the view that intercept the taps outside. [self.dismissalView removeFromSuperview]; self.dismissalView = nil; if (animated) { CGRect newFrame = self.view.frame; // When in landscape Mode the width of the screen is actually the "height" newFrame.origin.y = [UIScreen mainScreen].bounds.size.width; [UIView animateWithDuration:0.5 animations:^{self.view.frame = newFrame;} completion: ^(BOOL finished) {if(finished) [self.contentViewController.view removeFromSuperview];}]; } else { [self.contentViewController.view removeFromSuperview]; } isPresented = NO; [self.delegate customPopoverDidDismissPopover:self]; }
问题是,即使在任何情况下调用removeFromSuperView – 动画与否,在我发布contentViewController时,contentViewController永远不会收到viewWillDisappear,viewDidDisappear甚至viewDidUnload;
有谁知道为什么?
或者甚至更好地在viewWill … / viewDid …方法链上抛出一些亮点,以及它们应该被调用的时间.
以上是大佬教程为你收集整理的iphone – viewWillDisappear和viewDidDisappear永远不会被调用全部内容,希望文章能够帮你解决iphone – viewWillDisappear和viewDidDisappear永远不会被调用所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。