本文介绍了DisplayActionSheet不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MessagingCenter从模型中发出MasterDetailPage信号.

I'm using MessagingCenter to signal a MasterDetailPage from my model.

private void ShowActionSheet(object sender, IEnumerable<string> hosts)
{
    Device.BeginInvokeOnMainThread(async () =>
    {
        // Works
        await DisplayAlert("Testing!", "Some text", "OK");

        // Does not work
        await DisplayActionSheet("Test", "Cancel", "Destroy", new[] {"1","2"});
    }
}

致电DisplayActionSheet时,出现以下警告:

When calling DisplayActionSheet I get the following warning:

Warning: Attempt to present <UIAlertController: 0x7e737aa0> on <Xamarin_Forms_Platform_iOS_NavigationRenderer: 0x7e4b31a0> whose view is not in the window hierarchy!

在MasterDetailPage顶部有一个请稍候"模式.它可以在没有模态的情况下工作,但这并不是一个可以接受的解决方案.

There's a "Please wait"-modal on top of the MasterDetailPage. It works without the modal, but that's not really an acceptable solution.

任何提示或指示,将不胜感激.

Any tips or pointers will be appreciated.

更新:我已将DisplayActionSheet移至模态作为最后的手段.我仍然担心此问题与iOS 8.2相关.

UPDATE: I've moved DisplayActionSheet to the modal as a last resort. I still fear that this issue is iOS 8.2 related.

推荐答案

更改代码:

Device.StartTimer(new TimeSpan(0,0,0,0,500),ShowActionSheet);

Device.StartTimer(new TimeSpan(0, 0, 0, 0, 500), ShowActionSheet);

async Task<bool> ShowActionSheet()
{
    await DisplayActionSheet("Test", "Cancel", "Destroy", new[] {"1","2"});
    return false;
}

这篇关于DisplayActionSheet不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 17:28