definesPresentationContext
全部标签 我在xcode9.1中使用Swift4。这个问题有点令人困惑,所以我提供了一些图片希望能帮到您。这是我的设置:当我从VC1导航到subVC1,然后切换到VC2并进入subVC2,然后切换回subVC1时,一切正常。当我在VC1的搜索栏中输入内容后执行上述操作时,我得到ViewA(下图,黑屏)。当我为VC1设置definesPresentationContext=true时,这解决了黑屏问题但产生了新问题。通常,当您在搜索器中输入内容从subCV1返回到VC1时,它看起来像ViewB(下图,中间面板)。使用definesPresentationContext=true,VC1在从subV
我的应用程序中有以下代码,特别是在viewDidLoad:中,它设置了我的UISearchController。self.searchController=[[UISearchControlleralloc]initWithSearchResultsController:nil];self.searchController.searchResultsUpdater=self;self.searchController.hidesNavigationBarDuringPresentation=NO;self.searchController.dimsBackgroundDuringPre
我的应用程序中有以下代码,特别是在viewDidLoad:中,它设置了我的UISearchController。self.searchController=[[UISearchControlleralloc]initWithSearchResultsController:nil];self.searchController.searchResultsUpdater=self;self.searchController.hidesNavigationBarDuringPresentation=NO;self.searchController.dimsBackgroundDuringPre
我正在使用ViewController包含来管理一组subviewController,这些subviewController应该能够以自定义方式模态呈现其他ViewController。当使用UIModalPresentationStyle.custom从ViewController呈现时,我遇到了definesPresentationContext属性未使用的问题/p>例如,我有三个ViewController:ROOT、A和BROOT|_AA是ROOT的子项。我想在使用自定义UIPresentationController、UIViewControllerTransitionin
我正在使用ViewController包含来管理一组subviewController,这些subviewController应该能够以自定义方式模态呈现其他ViewController。当使用UIModalPresentationStyle.custom从ViewController呈现时,我遇到了definesPresentationContext属性未使用的问题/p>例如,我有三个ViewController:ROOT、A和BROOT|_AA是ROOT的子项。我想在使用自定义UIPresentationController、UIViewControllerTransitionin
我在使用UISearchController时遇到问题,如果我在搜索栏中有文本并关闭它所在的VC,搜索栏将不会消失,只会保留在屏幕上,与其他VC中的所有内容重叠。然后,如果您点击取消按钮,它就会崩溃。在SO上尝试了一些解决方案,但没有一个有效。:/self.resultSearchController=({letcontroller=UISearchController(searchResultsController:nil)controller.searchResultsUpdater=selfcontroller.dimsBackgroundDuringPresentation=f
我在使用UISearchController时遇到问题,如果我在搜索栏中有文本并关闭它所在的VC,搜索栏将不会消失,只会保留在屏幕上,与其他VC中的所有内容重叠。然后,如果您点击取消按钮,它就会崩溃。在SO上尝试了一些解决方案,但没有一个有效。:/self.resultSearchController=({letcontroller=UISearchController(searchResultsController:nil)controller.searchResultsUpdater=selfcontroller.dimsBackgroundDuringPresentation=f
这仅在您在由导航Controller管理的ViewController中呈现时才有效。复制步骤为:1-使用UIModalPresentationCurrentContext呈现ViewControllerself.definesPresentationContext=YES;ViewController*viewController=[[ViewControlleralloc]init];viewController.modalPresentationStyle=UIModalPresentationCurrentContext;[presentOnViewControllerpres
我有一个带有导航栏HIDDEN的UIViewController,顶部有几个按钮,以及带有UISearchControllerUITableView/作为标题。问题是:当我创建UISearchController时,我也有这一行:self.definesPresentationContext=YES;现在发生的事情是,当我使用UISearchController进行搜索并单击UITableView中的结果之一时,它会打开我的以下UIViewController(这正是它应该做的——下面的UIViewController也隐藏了导航栏)正确但它在UIViewController,即使我将
ViewController有definesPresentationContext和providesPresentationContextTransitionStyle,但不知道它们是如何工作的。我看了WWDC2011,但我仍然对这两件事感到困惑。谁能解释一下,最好是用一个简单的演示? 最佳答案 这两个属性都用于包含ViewController,并为subviewController提供覆盖窗口RootViewController的表示上下文或表示样式的选项。作为引用,这里是相关的WWDC演示文稿,其中提供了对两者的解释:https