Skip to content

Instantly share code, notes, and snippets.

@prashantvc
Created May 8, 2013 14:33
Show Gist options
  • Save prashantvc/5540863 to your computer and use it in GitHub Desktop.
Save prashantvc/5540863 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.Dialog;
namespace TwoLayerDialog
{
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
// class-level declarations
UIWindow window;
UINavigationController navigation;
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
var menu = new RootElement ("Settings")
{
new Section ("Test")
{
new StringElement("Profile", CreateSecondLayer),
}
};
var dv = new DialogViewController (menu) {
Autorotate = true
};
navigation = new UINavigationController ();
navigation.PushViewController (dv, true);
window = new UIWindow (UIScreen.MainScreen.Bounds);
window.MakeKeyAndVisible ();
if (UIDevice.CurrentDevice.CheckSystemVersion (5, 0))
window.RootViewController = navigation;
else
window.AddSubview (navigation.View);
return true;
}
public void CreateSecondLayer()
{
var root = new RootElement ("Second") {
new Section (){
new BooleanElement ("Airplane Mode", false),
}
};
var dv = new DialogViewController(root, true);
navigation.PushViewController(dv, true);
dv.NavigationItem.RightBarButtonItem = new UIBarButtonItem("Save", UIBarButtonItemStyle.Bordered, null);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment