navigation - Push multiple pages in Xamarin Forms -


i have several situations in i'd push multiple pages modally 1 action. 1 situation @ start of application, i'd initialize main-page , push splash-page above it. think clean way initialize app, because main-page loaded upfront , spash page pushed above it. when user dismisses splash page can pop splash page , done. follwing in application class:

public app()     {         initializecomponent();          mainpage mainpage = new mainpage();         splashpage splashpage = new splashpage();         mainpage = mainpage;         mainpage.navigation.pushmodalasync(splashpage,false);     } 

my problem is, while on android works expected, on ios there short timeframe in mainpage shown, overlayed splash page. doesn't , irretating user.

i'm aware, can handle above example in other ways, setting splash page mainpage , swapping page when user dismissed splash page. have other situations in it's not easy, , logical design page stack upfront.

so, question is, how push several pages modal stack without showing each page short timeframe on ios.

my answer use navigation.insertpagebefore().

ios suggests make splash page super simple version of main page. lot of people not because want show stylish splash page world. might able use same idea this. if splash page red background logo in middle, set mainpage empty contentpage red background, pushmodalasync splash page on top, add mainpage in front of basic contentpage. once done, pop splash , user left staring @ main.

code time:

contentpage basicsplash = new contentpage { backgroundcolor = color.red }; navigationpage nav = new navigationpage(basicsplash); //do navigation page here basic in  mainpage = nav; //set basic splash  nav.navigation.pushmodalasync(new splashpage(), false); //show splashpage modal on basic  nav.navigation.insertpagebefore(new mainpage(), basicsplash); //you adding mainpage navigationstack, not modalstack  nav.navigation.removepage(basicsplash); //remove basic splash, mainpage left sitting in navigationstack  //now can nav.popmodalasync() when ready , user should looking @ mainpage since there nothing left in modalstack , mainpage sitting in navigationstack 

the problem here would need prevent user going basicsplash either removing page stack, setting mainpage your.... mainpage, or removing button and/or overriding contentpage.onbackbuttonpressed


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

.htaccess - ERR_TOO_MANY_REDIRECTS htaccess -