override CreatePresenter() method in Setup file is not called

DanilKachanovDanilKachanov UAMember ✭✭
edited August 2015 in Xamarin.iOS

Hello.

In Setup file i write the next code, that must resturn my custom elements:

protected override IMvxTouchViewPresenter CreatePresenter ()
{
return new CustomViewPresenter (this.ApplicationDelegate,this.Window);
}

but it is not called. How I Can fix it?

Give me answer please.
I attached link for other my discussion, that contains more info and solution with app.
https://forums.xamarin.com/discussion/47303/bad-view-of-animations-with-navigation-from-page-to-page-use-mvvmcross
Thanks!

Best Answer

Answers

  • Martijn00Martijn00 NLInsider, University ✭✭✭

    Can you include the full code of your setup class so i could have a look on what is going on?

  • DanilKachanovDanilKachanov UAMember ✭✭
    edited August 2015

    Can you include the full code of your setup class so i could have a look on what is going on?

    This is it.

    namespace NavigationSampleNative.IOS
    {
     using NavigationSampleNative.Helpers;
     using Cirrious.CrossCore.Platform;
     using Cirrious.MvvmCross.Touch.Platform;
     using Cirrious.MvvmCross.Touch.Views.Presenters;
     using Cirrious.MvvmCross.ViewModels;
     using UIKit;
    
     public class Setup : MvxTouchSetup
     {
      public Setup(MvxApplicationDelegate applicationDelegate, UIWindow window)
                : base(applicationDelegate, window)
      {
      }
    
      public Setup (MvxApplicationDelegate delegat, IMvxTouchViewPresenter presenter)
       : base(delegat, presenter)
      {
      }
    
      protected override IMvxApplication CreateApp()
      {
       this.RegisterPresenter ();
       return new NavigationSampleNative.ViewModels.App();
      }
    
            protected override IMvxTrace CreateDebugTrace()
            {
                return new DebugTrace();
            }
    
      protected override Cirrious.MvvmCross.Touch.Views.IMvxTouchViewsContainer CreateTouchViewsContainer ()
      {
       return new TouchViewsContainer ();
      }
    
      protected override IMvxTouchViewPresenter CreatePresenter ()
      {
       return new CustomViewPresenter (this.ApplicationDelegate,this.Window);
      }
     }
    }
    
  • Martijn00Martijn00 NLInsider, University ✭✭✭

    That looks like it could work. I am wondering how do you call the Setup class?

    You should call it from the AppDelegate to make this work:

    public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            window = new UIWindow(UIScreen.MainScreen.Bounds);
    
            var setup = new Setup(this);
            setup.Initialize();
    
            var startup = Mvx.Resolve<IMvxAppStart>();
            startup.Start();
    }
    
Sign In or Register to comment.