- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
注意: 在阅读这个问题之前请注意,我已经阅读了前面的问题,这些问题解释了苹果实现 UISplitViewController 的不足以及我应该如何使用开源的“MGSplitViewController”,因为简单地在 Split View上隐藏主视图 Controller 并不容易横向模式下的 Controller 。请记住,我仅限于在 iOS 5.1 中使用普通的 UISplitViewController。
现在进入问题:
我有一个 Split View Controller ,左侧是 TableView (主视图),右侧是详细 View Controller 。我正在使用导航 Controller 来控制左侧,这是一个转换到另一个 TableView (“DataTableViewController”)的 TableView 。为了隐藏这个左侧,我在详细 View Controller 的导航工具栏上放置了一个“隐藏”按钮。按下隐藏按钮时,我更改了“_hideMaster”属性:
-(IBAction)hidePressed
{
_hideMaster = !_hideMaster;
// Must manually reset the delegate back to self in order to force call "shouldHideViewController"
self.splitViewController.delegate = nil;
self.spliteViewController.delegate = self;
}
然后在 SplitViewController 委托(delegate)中自动调用此方法:
// This is called when I change the delegate from nil back to self.
- (BOOL)splitViewController: (UISplitViewController*)svc shouldHideViewController: (UIViewController *)vc inOrientation:(UIInterfaceOrientation)orientation
{
return _hideMaster;
}
当我调试它时,我可以看到一切都按计划进行,并且当它进入方法 splitViewController:shouldHideViewController:inOrientation:
唯一的问题是什么也没有发生。我最左边的 TableView (DataTableViewController
) 没有消失。当我仔细观察时,委托(delegate)方法中的 (UIViewController *)vc
参数不是我要隐藏的 TableView Controller ,而是与此 TableView 关联的导航 Controller 。所以本质上它是在试图隐藏导航 Controller ——这显然不是我想要的……
如何才能使自动调用的委托(delegate)方法 (shouldHideViewController:
) 中的 UIViewController 参数调用与该导航 Controller 关联的最顶层 View Controller ? (毕竟我想隐藏DataTableViewController
)
最佳答案
我是这样处理的。如果 MasterViewController 在回来的路上没有实例化,可能需要做更多的工作才能重新出现。
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.30f];
[[self.splitViewController.viewControllers lastObject] view].frame = self.splitViewController.view.frame;
[UIView commitAnimations];
关于ios - UISplitViewController 不会在横向模式下隐藏 masterViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11856312/
我一直在努力解决一个非常奇怪的问题。在我的 iPad Storyboard中,我拖动了一个 UISplitViewController。对于详细 View Controller ,我放置了一个 UII
注意: 在阅读这个问题之前请注意,我已经阅读了前面的问题,这些问题解释了苹果实现 UISplitViewController 的不足以及我应该如何使用开源的“MGSplitViewController
我有一个带有 3 个选项卡的 tabbarcontroller,它们是 splitviewcontrollers。 它工作正常,除非: 在纵向 View 中点击 rootview 按钮以显示主视图 弹
我正在我的应用程序中实现 SplitViewController。我的问题是,当我在较小的设备(例如 iphone5)上显示此内容时,我的 SplitViewController 的 masterVi
我正在使用 Xcode UISplitViewController 默认模板来创建应用程序。 我的应用程序将仅是横向的。 我想让masterViewController更宽...例如400 px。我希
技术:XCode 7.0、Swift 2 在我的 detailViewController 文件中,我有(除其他外): var masterViewController: MasterView
我有一个 UISplitViewController,它仅在横向显示时才显示 MasterViewController,这是默认设置。 如果我以纵向开始,单击按钮播放视频(我的应用程序的主要功能),然
我有一个 UISplitViewController,它使主视图和细节 View 在纵向和横向方向上都可见。一切正常,除了当页面以纵向模式打开时,masterViewController 被隐藏,直到
我正在开发一款具有 Split View的应用程序,到目前为止它运行良好,但无法使用 preferredPrimaryColumnWidthFraction 设置主 Controller 的宽度。应用
当使用溢出 View Controller 时,我有一个主视图和一个详细 View 。当 iPad 处于纵向模式时,主视图显示为弹出窗口。如何调整主视图(弹出 View )的高度?我试过: self
我正在更新我现有的应用程序以包含适用于 iPad 的 SplitView。 我让它与 UITabBar 一起工作,但我的 masterViewController 出现问题,因为它生成了一个“重复”导
在我的应用程序上,有多个 View ,您可以在其中输入某些值(设置),因此这些设置会使用委托(delegate)发送回主视图。我已经有了另外 2 个 View 的设置,只需复制并粘贴所需的代码并更改变
我无法让 .plist 文件填充 masterviewcontroller 中的 TableView 。我正在关注一本书,代码与书中所写的完全相同,但运行代码时我在线程 1 上收到 EXC_BAD_I
我有以下 MasterViewController: - (id) init{ self = [super init]; if(self){ //self.title = @"Main Men
I am working with UISplitViewController,where i need to hide MasterViewController for 1st DetailView
Picture of my storyboard, i use a login screen first and then the splitview我将 TabBarController 嵌入到通用
我有一个 DetailViewController,它是一个子菜单的委托(delegate),在应用程序启动开始时尚未推送。这里我想知道将 delegate 属性分配给 ViewController
我有一个 Split View,效果很好。但是,我希望能够深入了解我的主从 View 的 UITableView。例如,我有一个年龄列表:0, 1, 2, 3, 4, 5。当用户按下 3 时,我希望显
我有一个 tableView,我从中导航到一个“viewController”,即 PassengerInfoViewController,我在其中有一个表单。我填写表单,制作一个 dictionar
我有一个 SplitViewController 设置有一个 DetailViewController 和一个 MasterViewController。 DetailViewController 包
我是一名优秀的程序员,十分优秀!