![](/img/trans.png)
[英]UIViewController in storyboard reference class from other target
[英]Incorrect Class type when loading a UIViewController from Storyboard
我的情節UIViewController
中有一個UIViewController
,為此我設置了自己的自定義類MyCustomClass
(擴展了UIViewController
)
該視圖控制器中有一個按鈕,點擊此按鈕會顯示一個UIAlertView
。 簡單? 這是我的問題:
我得到:
Unknown class MyCustomClass in Interface Builder file.
當我將視圖控制器推到UINavigationController
:
MyCustomClass *vc = [story instantiateViewControllerWithIdentifier:@"MyCustomClassView"];
NSLog(@"receiver's type: %@", NSStringFromClass([vc class]));
當我點擊該視圖控制器內的按鈕時,這會導致應用程序崩潰。 有什么原因可能會發生這種情況?
原來我的魷魚目標缺少頭文件。 不知道為什么。 我創建了主要構建目標的克隆,並為此添加了適當的代碼。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.