Question

I have an app written for iOS7....

I Have The Following Code In My AppDelegate

[Register ("AppDelegate")]
        public partial class AppDelegate : UIApplicationDelegate
        {
            // class-level declarations
            UIWindow window;
            UINavigationController navigationController;
            HomeViewController_iPhone homeViewController;

        public override bool FinishedLaunching (UIApplication app, NSDictionary options)
        {
            window = new UIWindow (UIScreen.MainScreen.Bounds);

            homeViewController = new HomeViewController_iPhone ();
            navigationController = new UINavigationController (homeViewController);
            window.RootViewController = navigationController;
            window.MakeKeyAndVisible ();

            return true;
        }
    }

It fails on this line

navigationController = new UINavigationController (homeViewController);

HomeViewController is a UINavigationController class...

I Receive The Following Error When Building My Code MonoTouch.Foundation.MonoTouchException has been thrown. Objective-C exception thrown. Name NSInvalidArgumentException Reason: Pushing A Navigation Controller Is Not Supported.

Any ideas?

Was it helpful?

Solution

Ask yourself why do you create a new UINavigationController on your UINavigationController ?

If your homeViewController is a UINavigationController then simply do:

window.RootViewController = new HomeViewController_iPhone ();

or maybe your homeViewController should not be a navigation controller ?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top