我正在使用Xamarin monotouch c#显示PDF文档的iphone应用程序。在iOS 7中退出UIDocumentInteractionController的PDF时出现黑色屏幕
我的问题是,我得到离开在UIDocumentInteractionController一个PDF时,黑屏后,我升级到iOS 7
在源构造函数中我做一个新DocController:
this.DocumentPreview = new UIDocumentInteractionController();
this.DocumentPreview.Delegate = new DocumentInteractionDelegate(this.DidEndPreview);
当我选择一行我得到的PDF,并显示它(工作):
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
{
// Get PDF url from indexpath
...
// Set url
this.DocumentPreview.Url = url;
this.DocumentPreview.PresentPreview(true);
// Here i get a warning : Presenting view controllers on detached view controllers is discouraged
}
这是我DocControllerDelegate类呈现预览我的工作空间:
public class DocumentInteractionDelegate : UIDocumentInteractionControllerDelegate
{
private Action DidEnd;
public DocumentInteractionDelegate(Action didEnd)
{
this.DidEnd = didEnd;
}
public override UIViewController ViewControllerForPreview(UIDocumentInteractionController controller)
{
return AppDelegate.Instance.Workspace;
}
public override void DidEndPreview(UIDocumentInteractionController controller)
{
this.DidEnd.Execute();
}
}
DidEnd操作并不重要,因为操作触发时黑屏已经存在。
是的,我已经设置了根控制器:
this.MainWindow.RootViewController = this.MainViewController;
我不知道是否该警告是有在iOS6的,但我可能来自我的PDF就好了回来,并选择另外一个在我的表显示和现在在iOS7我点击在PDF中完成时出现黑屏。
如何返回我的控制器而没有黑屏,以及iOS7中的哪些更改影响了此行为?
谢谢
编辑
我已成功地摆脱了警告上分离视图控制器呈现视图控制器是不鼓励在工作区本:
this.MainViewController.AddChildViewController(this.Workspace);
但我仍然在解雇PDF时进入黑屏。
什么是发生在“DidEndPreview”,里面我假设你的“工作区”类,这是一个UITableViewController?您是否有一个变量会导致文档预览窗口在错误的时间显示返回到您的工作区控制器? –
DidEndPreview只显示我的表模式作为我的工作区控制器的弹出窗口,只有当我让我的ViewControllerForPreview返回我的AppDelegate.Instance.Workspace时,它才正确执行。我假设你提出的解决方案只适用于navControllers。我很确定iOS7中的某些东西现在已被窃听,因为即使我的弹出式表模式显示我的xamarin在我尝试启用任何断点时会冻结。 –
是的。很有可能。关于Stackoverflow真是太糟糕了,是你没有得到..尝试的声誉。嘿。 –