简体   繁体   中英

Pushing to viewController from appDelegate monoTouch

I am trying to setup a Getting started viewController. In the appDelegate I want to create a if condition that checks for a NSUserDefaults Like this:

public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
        {

            if (NSUserDefaults.StandardUserDefaults.StringForKey ("LaunchWatcher") != null) {



            } else {


            }


            return true;
        }

If LaunchWatcher is not null, appDelegate should push to NewTrackTraceViewController. If null then to TrackTraceViewController. How can I do this using C#? What would be the correct code to push to the viewcontroller?

Something like this:

if (NSUserDefaults.StandardUserDefaults.StringForKey ("LaunchWatcher") != null) {

this.PresentViewController(NewTrackTraceViewController, animated, null);

            } else {

this.PresentViewController(TrackTraceViewController, animated, null);
            }

您必须先构造视图控制器,然后再导航控制器,并将其分配给窗口。

Take a look here:

Monotouch navigate from splash screen

Its basicly what you have to do. Just use the topviewcontroller.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM