iOS 5.1上的“新”UISplitViewController存在问题。
我激活了UISplitViewController.presentsWithGesture
,但它确实无效。
它只能工作一次,然后我必须改为水平视图。
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
// create a new window instance based on the screen size
window = new UIWindow (UIScreen.MainScreen.Bounds);
// load the appropriate UI, depending on whether the app is running on an iPhone or iPad
navigationController = new RootNavigationController();
detailViewController = new DetailViewController ();
detailViewController.HeaderView.Hidden=true;
navigationController.RootViewControllers[1].DetailVaiewController=detailViewController;
navigationController.DetailView=detailViewController;
splitDelegate = new SplitViewDelegate();
var prefs = NSUserDefaults.StandardUserDefaults;
String AutoUpdate= prefs.StringForKey("autoUpdate");
if(AutoUpdate=="Yes"){
navigationController.StartUpdate(true);
}
if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone) {
window.RootViewController = navigationController;
}
else {
splitViewController = new SplitViewController ();
splitViewController.WeakDelegate = detailViewController;
splitViewController.ViewControllers = new UIViewController[] {
navigationController,
detailViewController
};
splitViewController.Delegate=splitDelegate;
window.RootViewController = splitViewController;
}
window.MakeKeyAndVisible ();
return true;
}
class SplitViewController:UISplitViewController{
public SplitViewController():base(){
}
}
class SplitViewDelegate:UISplitViewControllerDelegate{
public SplitViewDelegate():base(){
}
public override void WillShowViewController (UISplitViewController svc, UIViewController aViewController, UIBarButtonItem button)
{
// TODO: Implement - see: http://go-mono.com/docs/index.aspx?link=T%3aMonoTouch.Foundation.ModelAttribute
Console.WriteLine("Show");
}
public override void WillHideViewController (UISplitViewController svc, UIViewController aViewController, UIBarButtonItem barButtonItem, UIPopoverController pc)
{
// TODO: Implement - see: http://go-mono.com/docs/index.aspx?link=T%3aMonoTouch.Foundation.ModelAttribute
Console.WriteLine("Hide");
}
public override void WillPresentViewController (UISplitViewController svc, UIPopoverController pc, UIViewController aViewController)
{
Console.WriteLine("Will Present");
}
}