简体   繁体   English

Xamarin.Forms.Navigation.PopAsync()不会弹出页面

[英]Xamarin.Forms.Navigation.PopAsync() Does Not Pop Page

In Xamarin.Forms, when we use Navigation.PopAsync() , the page does not pop in iOS. 在Xamarin.Forms中,当我们使用Navigation.PopAsync() ,页面不会在iOS中弹出。

After PopAsync() the same page remains. PopAsync() ,相同的页面仍然存在。

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. 如果您使用Navigation.PushAsync()将页面推送到导航堆栈,请使用Navigation.PopAsync()将页面弹出导航堆栈。

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. 如果您使用Navigation.PushModalAsync()将页面推送到导航堆栈,请使用Navigation.PopModalAsync()将页面弹出导航堆栈。

Use BeginInvokeOnMainThread 使用BeginInvokeOnMainThread

All UI updates must be done on the main thread. 所有UI更新必须在主线程上完成。 To ensure that this request is happening on the main thread, use BeginInvokeOnMainThread : 要确保在主线程上发生此请求,请使用BeginInvokeOnMainThread

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

or 要么

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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