简体   繁体   中英

Xamarin.Forms.Navigation.PopAsync() Does Not Pop Page

In Xamarin.Forms, when we use Navigation.PopAsync() , the page does not pop in iOS.

After PopAsync() the same page remains.

Call the Proper Pop Method

If you pushed the page onto the Navigation Stack using Navigation.PushAsync() , use Navigation.PopAsync() to pop the page off of the Navigation Stack.

If you pushed the page on to the Navigation Stack using Navigation.PushModalAsync() , use Navigation.PopModalAsync() to pop the page off of the Navigation Stack.

Use BeginInvokeOnMainThread

All UI updates must be done on the main thread. To ensure that this request is happening on the main thread, use BeginInvokeOnMainThread :

Device.BeginInvokeOnMainThread(async () => await Navigation.PopAsync());

or

Device.BeginInvokeOnMainThread(async () => await Navigation.PopModalAsync());

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM