没有加载iOS开发所需的ViewController和View
我在 xCode 中创建了一个基于 Windows 的应用程序。我的问题是基于Windows的应用程序的目的是什么。现在,我想加载自定义控制器,但每当我运行应用程序时,都会执行 appname_iphone 内的任何内容。在我的 AppDelegate.m 中,我正在执行以下操作:
-(void) applicationDidFinishLaunching:(UIApplication *)application
{
[_window addSubview:jogViewController.view];
[_window makeKeyAndVisible];
}
但是 jogViewController 从未加载。 JogBuddyAppDelegate_iPhone 始终执行以加载视图。
更新 1:
在界面生成器中,我单击了 MainWindow_iPhone.xib,然后单击了 App Delegate,并将自定义类更改为 JogViewController。现在,当我运行该应用程序时,出现以下错误:
2011-07-12 13:06:19.925 JogBuddy[3139:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<JogViewController 0x5a067e0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key window.'
*** Call stack at first throw:
I created a windows based application in xCode. My question is that what is the purpose of windows based application. Now, I want to load my custom controller but whenever I run the application anything inside the appname_iphone is executed. Inside my AppDelegate.m I am doing the following:
-(void) applicationDidFinishLaunching:(UIApplication *)application
{
[_window addSubview:jogViewController.view];
[_window makeKeyAndVisible];
}
But jogViewController is never loaded. The JogBuddyAppDelegate_iPhone is always executed which loads the view.
UPDATE 1:
In the interface builder I clicked on the MainWindow_iPhone.xib and then I clicked on the App Delegate and changed the custom class to JogViewController. Now, when I run the application I get the following error:
2011-07-12 13:06:19.925 JogBuddy[3139:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<JogViewController 0x5a067e0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key window.'
*** Call stack at first throw:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否将视图控制器拖入 MainWindow.xib 并将其链接到您在应用程序委托中定义的视图控制器?
Did you drag a view controller in in MainWindow.xib and link it to the view controller you defined in the app delegate?