我正在使用 MonoDevelop 3.0.3 和 Monotouch 5.2.12
为什么在 iOS 5.1 中从未调用过“UISplitViewController”类中的“ShouldHideViewController”?
如果我没有分配“ShouldHideViewController”和“将显示/隐藏”属性,左/主视图会正确显示,但我无法在主视图(viewFees)中隐藏/显示“BarButtonItem”。
以下是我的拆分视图类代码:
using System;
using MonoTouch.UIKit;
namespace PlazaTimePad
{
public class FeesSplitViewController : UISplitViewController
{
CalendarMonthViewController viewCalendar;
FeeListViewController viewFees;
public FeesSplitViewController () : base()
{
this.TabBarItem.Title = "My Time";
viewFees = new FeeListViewController ();
viewCalendar = new CalendarMonthViewController (viewFees);
ViewControllers = new UIViewController[] {viewCalendar, viewFees};
WillHideViewController += (object sender, UISplitViewHideEventArgs e) => {
viewFees.AddContentsButton (e.BarButtonItem);
};
WillShowViewController += (object sender, UISplitViewShowEventArgs e) => {
viewFees.RemoveContentsButton ();
};
ShouldHideViewController += (svc, viewController, inOrientation) => {
return inOrientation == UIInterfaceOrientation.Portrait ||
inOrientation == UIInterfaceOrientation.PortraitUpsideDown;
};
}
}
}