0

我有一个 iPad 应用程序,它UISplitviewController设置为UIWindow. 主视图控制器(即左视图的视图控制器)是UISplitViewController's具有委托方法shouldHideViewController返回的委托YES,这意味着当应用程序首次启动时,左视图将被隐藏并且可以通过用户手势显示(和隐藏),我想要在导航到详细信息页面时显示主视图并防止用户使用手势隐藏它,我尝试调用shouldHideViewController委托上的方法以让它NO在第二次被调用时返回,但这次没有效果,主视图隐藏在详细页面中,可以通过用户手势显示。任何在这种情况下实现主视图显示的想法都将受到高度赞赏。

4

1 回答 1

1

This may only be a partial answer because I'm not sure what you mean that you call shouldHideViewController method on the delegate. My understanding is that only the UISplitView should call this method. If you call it, then it will not effect the UISplitView, because it wasn't what made the call. In other words, the delegate method is used by UISplitView to get some information (and allow you a place to do additional things to other stuff) but it is not used as a way to tell the UISplitView what to perform.

Having said that, at least for the gesture activation/deactivation, I would think that in splitViewController:shouldHideViewController:inOrientation: you could do something like

[svc setPresentsWithGesture:NO];

I don't see any way to programmatically tell the UISplitViewController to display or hide the master view controller because the delegate only tells it if it should proceed in presenting or hiding the master when it is going to try and do that. It does seem like there should be a way to do this though.

于 2013-06-22T13:12:48.930 回答