【发布时间】:2012-08-22 12:18:31
【问题描述】:
我有一个 UISplitViewController,它在 master 中有一个 UINavigationController,在 detail 中有一个 UIViewController。当设备定向为横向模式时,我希望保留正常行为。 IE。大师以横向显示并以纵向隐藏。
但是,取决于用户在主控中单击的内容,取决于将哪个 UIViewController 加载到 UISplitViewController 的详细信息部分。我想要的是当用户单击详细 UIViewController 中的按钮时,master 以横向模式隐藏。问题是我无法让它工作。
我的委托看起来像这样(为了便于查看,删除了一些行):
public class SplitControllerDelegate : UISplitViewControllerDelegate {
SplitViewController incomingController;
private bool hideMaster = false;
public override bool ShouldHideViewController (UISplitViewController svc,
UIViewController viewController,
UIInterfaceOrientation inOrientation) {
return hideMaster;
}
public void SetHideMaster(bool value) {
hideMaster = value;
}
}
然后我从详细的 UIViewController 中调用它,例如
splitControllerDelegate.SetHideMaster(value);
但是没有任何改变。我不确定如何使它执行更改?主人应该立即消失吗?是什么导致 WillHideViewController 触发?
谢谢
迈克
【问题讨论】:
标签: xamarin.ios uisplitviewcontroller uisplitviewdelegate