PDFドキュメントを表示するiPhoneアプリにXamarin monotouch c#を使用しています。
私の問題は、iOS 7 にアップグレードした後、UIDocumentInteractionController で PDF を終了すると黒い画面が表示されることです。
ソース コンストラクターで、新しい 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から戻ってきて、テーブルで別のPDFを選択して表示することができました.iOS7では、PDFで[完了]をクリックすると黒い画面が表示されます.
黒い画面を表示せずにコントローラーに戻るにはどうすればよいですか? また、iOS7 でのどのような変更がこの動作に影響を与えましたか?
ありがとうございました
編集
私は警告Presenting View Controllers on detached View Controller is discomured on Workspaceをこれで取り除くことができまし た:
this.MainViewController.AddChildViewController(this.Workspace);
しかし、PDFを閉じると黒い画面が表示されます。