0

我想向 monotouch/xamarin 项目添加启动画面。

初始屏幕应该执行一些逻辑,然后将用户导航到两个屏幕之一,登录屏幕/登录屏幕。

在monotouch中正确的方法是什么?(我是 monotouch 和 IOS 的新手)。

4

1 回答 1

2

我会怎么做,是这样的:

  1. 将您的启动画面设置为 rootviewcontroller,在后台执行您的逻辑,并开始检查用户是否已登录。
  2. 然后在异步完成调用中,将用户导航到登录屏幕并将其设置为导航控制器中的新 rootviewcontroller。如果用户未登录,请在已登录屏幕的顶部推送一个 topviewcontroller - 在您开始在登录屏幕中加载用户特定数据之前,请记住检查用户是否已登录。

例子:

        MySplashController splash;
        Navigationcontroller nav;
        UIViewController masterviewcontroller;

        Public override void FinishedLaunching(UIApplication app, NSDictionary options){

              splash = new MySplashController();
              window.rootviewcontroller = splash;
              window.makekeyandvisible();

        }
        void MyAsyncLoggedInCall(bool loggedin){
           if(loggedin)
             LoggedIn();
           else
             LogOn();
        }
        void LoggedIn(){
         masterviewcontroller = MyLoggedInScreen();
         nav = new navigationcontroller(masterviewcontroller);
         window.rootviewcontroller = nav;
        }
        void LogOn(){
         masterviewcontroller = MyLoggedInScreen();
         nav = new navigationcontroller(masterviewcontroller);
         window.rootviewcontroller = nav;
         nav.TopViewController.PresentModalViewController(new MyLogInScreen(),false);
        }

This is just one of the ways to do it. You can also look at how to implement the facebook login functions, and do something like that in your application, as its quite similar to your problem. Monotouch bindings

于 2013-03-10T16:28:19.243 回答