MacでVisual Studioで新しいXamarin.Formsアプリケーションを作成すると、デフォルトのテンプレートにはApp
クラスに次のコードが含まれています。メインページとナビゲーションの設定:iOSとAndroid
public partial class App : Application
{
public static bool UseMockDataStore = true;
public static string BackendUrl = "https://localhost:5000";
public App()
{
InitializeComponent();
if (UseMockDataStore)
DependencyService.Register<MockDataStore>();
else
DependencyService.Register<CloudDataStore>();
// What is the reason for this if statement?
if (Device.RuntimePlatform == Device.iOS)
MainPage = new MainPage();
else
MainPage = new NavigationPage(new MainPage());
}
}
最後のif文の理由は何ですか?それは、iOSとAndroidの違いと、それぞれがどのようにナビゲーションを処理するのか?誰か説明してもらえますか?