0
我想將我的window.rootViewController作爲UIPageViewController投射出去,但任何時候我訪問我定義它的類屬性都會與swift dynamic cast failed
一起爆炸。我的故事板有一個UIPageViewController是最初的場景。Swift動態投射失敗UIPageViewController
PageViewController只是一個UIPageViewController
class AppDelegate: UIResponder, UIApplicationDelegate, UIPageViewControllerDataSource {
var window: UIWindow!
var pageViewController: PageViewController {
return window.rootViewController as PageViewController
}
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
pageViewController.dataSource = self
return true
}
}
請發表您自己的解決方案作爲答案並接受它。其他人會遇到同樣的問題,因爲你有。 –
我回答了我的問題。自從我開始分類以來,它必須處理自定義類。 – slik