大家好。最近一直困擾我的東西就是我放在一起的這個自定義電影播放器。它主要基於一個工作的,NGMoviePlayer
。presentModalViewControllerAnimated:給出白屏
問題是這樣的:我有一個UIKit友好的資源包中的.xib
。當我打電話:
[MyMoviePlayerViewController initWithNibName:@"MyMoviePlayerViewController"
bundle:[NSBundle bundleWithPath:
[[NSBundle mainBundle] bundlePath]
stringByAppendingPathComponent:@"MyMoviePlayerViewController.bundle"]];
..on我的自定義類,然後訪問view
(因此調用loadView
)不拋出任何錯誤,但也沒有真正正確加載網點。我看到一個白色的屏幕,調試顯示所有的視覺元素都是0x0
,但沒有錯誤。
編輯:我現在也試過在我的目標應用程序的資源包之外加載.xib,同樣的事情發生(白屏)。
特定的人我一直在尋找要麼是:
Could not load NIB <nibname>...
如果它不是在所有發現的,或...loaded the <nibname> NIB but the view outlet was not set
,如果它被發現,但沒有正確連接
的xib在本地應用程序中(我瞭解靜態庫不能包含xibs)。我一直在使用與的NGMoviePlayer
作者提供的NGMoviePlayerDemo
項目此相同的資源包嘗試,它確實拋出一個錯誤:
Could not load NIB in bundle:
'/Users/.../MyMoviePlayerViewController.bundle (not yet loaded)'
with name 'MyMoviePlayerViewController'
我已導航的路徑將顯示爲捆綁和存在在該位置的MyMoviePlayerViewController.xib
文件。
我也嘗試過使用bundle:nil
以防Xcode將bundle目錄的資源與主目錄的資源合併在一起。這兩種情況下都不會出現錯誤,並在我的實際項目中顯示白色屏幕。這兩種情況在NGMoviePlayerDemo
項目中都會出現Could not load NIB
錯誤。
編輯:我已經嘗試了與NGMoviePlayerDemo
應用程序中的資源包分開的相同的.xib,它工作正常。
所有的輸入是非常感謝。