2014-09-30 62 views
0

我有一個視圖控制器yViewController錯誤「嘗試在其視圖不在窗口層次結構中的yViewController上呈現xViewController!」 iOS8

[self.window.rootViewController.view addSubView:yViewController.view] 

我有yViewController一個出口UIButton和觸摸我使用以下代碼來呈現它顯示在一個UIPopOverController一個xViewCOntroller

[popOver presentPopOverFromRect:button.frame inView:self.buttonContainerView permittedArrowDirections:UIPopOverArrowDirectionAny animated:NO] 

我如下將其添加到rootViewController它適用於iOS 7,但我在iOS 8上有錯誤:

Attempt to present xViewController on yViewController whose view is not in the window hierarchy! 

有什麼建議嗎?

回答

0
+0

不,你是說我應該在viewController中實現這些方法,我將其作爲子視圖添加到rootViewController中?我需要通知什麼? – 2014-09-30 08:49:47

+0

您需要通知yViewController它已被添加到父視圖控制器中 – 2014-09-30 08:55:11

+0

我確實在yViewController中包含了這兩種方法,但popOver仍然沒有出現。仍然拋出相同的警告 – 2014-09-30 10:21:45

相關問題