出于某种原因,当我仅在ios上从一个页面导航到另一个页面时,不显示displayalert。它适用于Android。这是简单的代码
//Navigating to other page
Navigation.PushAsync(new page1());
//Page1 Code
public page1()
{
InitializeComponent();
DisplayAlert("Test", "Test Successful", "Ok");
}
尝试下面它会适合你
Device.BeginInvokeOnMainThread (() =>
{
DisplayAlert("Test", "Test Successful", "Ok");
});
http://developer.xamarin.com/guides/cross-platform/xamarin-forms/working-with/pop-ups/
另一种变体 - 从当前MainPage调用DisplayAlert。
await Application.Current.MainPage.DisplayAlert("Test", "Test Successful", "Ок");