2016-06-15 7 views
0

私はMZFormSheetPresentationControllerを使用して、ViewController1を介してViewController2(ナビゲーションコントローラに組み込まれている)を「ポップアップ」として表示しています。View over view hierarchical

私ViewController1は検索バー、UISegmentedControlとテーブルビューました:ユーザーが検索バーのブックマークボタンをクリックすると、ポップアップが

Image1

示されています。

Image2

私は、ユーザーが実行ボタンをクリックしたときにポップアップを閉じたいのですが、それは、self.dismissViewControllerAnimated(真、完了:ゼロ)を使用して、素晴らしい作品方法が、私が探しているのもっと。私は再びViewController1を提示したいので、tableViewはデータをリロードします。 私は試してみました:

self.dismissViewControllerAnimated(true, completion: nil) 
     print("Dismissed") 

     //goToTickets 
     let next = self.storyboard?.instantiateViewControllerWithIdentifier("myTabBar") as! UITabBarController 
     self.presentViewController(next, animated: true, completion: nil) 

が、私はこのエラーを取得:

Warning: Attempt to present on whose view is not in the window hierarchy!

ポップアップが消えますが、私はViewControllerをを提示することはできません。

どうすればいいですか?

ありがとうございます。

編集

これは、識別子 "NavigationFilterを"

Image4

と私のタブバーと私のViewController2です:あなたは却下の真ん中にある場合

Image5

答えて

1

あなたはneを提示しようとしているXTのViewControllerは、あなたが完了ハンドラを待つ必要が、その後、このような存在次のビューコントローラ:

self.dismissViewControllerAnimated(true, completion: { 
    let next = self.storyboard?.instantiateViewControllerWithIdentifier("myTabBar") as! UITabBarController 
    self.presentViewController(next, animated: true, completion: nil) 
}) 
+0

私が試したが、私はまだエラーを取得し、私は、あなたがどこかにあなたのビュー階層での問題を抱えているviewController2 – Jigen

+0

にこのコードを書きましたMZFormSheetPresentationControllerは通常のモーダルプレゼンテーションコントローラと同じように動作するので、通常のプレゼンテーションを使用してMZFormSheetPresentationControllerを使用するようにしてください。 – mientus

+0

私の質問をアプリケーションの構造で更新しました。私は本当にこのエラーがどのように発生するのかわかりません。 – Jigen