I have a multiple screen application. From the level1 screen you can access the level2 screen then the level3 screen. My problem is when I come back from the level3 screen to the level2 screen. The back button is missing (see image) in the level2 screen, but only if I come from the level3 screen. Can you help me please?
AppDelegate.cs
namespace MultiLevelApp
{
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
UIWindow window;
UINavigationController navController;
DialogViewController level1ViewController;
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
window = new UIWindow (UIScreen.MainScreen.Bounds);
window.MakeKeyAndVisible ();
navController = new UINavigationController ();
level1ViewController = new Screens.Level1Screen ();
navController.PushViewController(level1ViewController, false);
window.RootViewController = navController;
window.MakeKeyAndVisible ();
return true;
}
}
}
Level1Screen.cs
namespace MultiLevelApp.Screens
{
public partial class Level1Screen : DialogViewController
{
public Level1Screen () : base (UITableViewStyle.Grouped, null)
{
}
public override void ViewWillAppear (bool animated)
{
base.ViewWillAppear (animated);
StyledStringElement element = new StyledStringElement ("Go to Level2", () => {GoToLevel2 (); });
Section section = new Section ();
section.Add (element);
Root = new RootElement ("Level 1") { section };
}
protected void GoToLevel2()
{
DialogViewController level2Screen = new Screens.Level2Screen ();
NavigationController.PushViewController(level2Screen, true);
}
}
}
Level2Screen.cs
namespace MultiLevelApp.Screens
{
public partial class Level2Screen : DialogViewController
{
public Level2Screen () : base (UITableViewStyle.Grouped, null)
{
}
public override void ViewWillAppear (bool animated)
{
base.ViewWillAppear (animated);
StyledStringElement element = new StyledStringElement ("Go to Level3", () => {GoToLevel3 (); });
Section section = new Section ();
section.Add (element);
Root = new RootElement ("Level 2") { section };
}
protected void GoToLevel3()
{
DialogViewController level3Screen = new Screens.Level3Screen ();
NavigationController.PushViewController(level3Screen, true);
}
}
}
Level3Screen.cs
namespace MultiLevelApp.Screens
{
public partial class Level3Screen : DialogViewController
{
public Level3Screen () : base (UITableViewStyle.Grouped, null)
{
}
public override void ViewWillAppear (bool animated)
{
base.ViewWillAppear (animated);
Section section = new Section ();
section.Add (new StyledStringElement ("this is the last level"));
Root = new RootElement ("Level 3") { section };
}
}
}