MonoTouch:UITabBarController 抛出“已加载笔尖,但未设置视图出口”
我一直在网上搜索,但找不到解决方案。
我创建了一个新的 MonoTouch iPhone 解决方案。
我创建一个名为 myTestView 的新视图。
我添加了一个 UITabBarController
。
我保存并退出 Interface Builder。
在 AppDelegate.cs
中,我有这段代码...
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
window = new UIWindow (UIScreen.MainScreen.Bounds);
viewController = new myTestView ();
window.RootViewController = viewController;
window.MakeKeyAndVisible ();
return true;
}
我运行应用程序并收到此错误:加载了“myTestView”笔尖,但未设置视图插座
Emmm 我可以不知道我错过了什么设置。有什么想法吗?
I've been searching the web, but can't find a solution.
I create a new MonoTouch iPhone solution.
I create a new view called myTestView.
I add a UITabBarController
.
I save and exit Interface Builder.
In AppDelegate.cs
I have this code...
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
window = new UIWindow (UIScreen.MainScreen.Bounds);
viewController = new myTestView ();
window.RootViewController = viewController;
window.MakeKeyAndVisible ();
return true;
}
I run the app and get this error: loaded the "myTestView" nib but the view outlet was not set
Emmm I can't figure out what setting I miss. Any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
每个 XIB 文件都有一个名为“view”的默认出口。
它必须连接到 ViewController 中您想要的根 View,否则您会收到消息:“未设置视图出口”。
举例来说,假设我想要一个新的 UITableViewController:
这应该可以解决您的错误。
There is a default outlet for every XIB file called "view".
It must be hooked up to the root View you want in your ViewController, otherwise you get the message: "view outlet was not set".
So for example, let's say I want a new UITableViewController:
This should resolve your error.
您是否将新视图创建为带有控制器的视图?这是唯一对我有用的视图类型。
您还应该检查一些其他事项:
1)确保您的构造函数在主视图文件中存在且正确:
2)确保设计器文件已正确创建并具有正确的信息:
Did you create your new view as a View with Controller? This is the only view type that has worked for me.
You should also check a couple of additional things:
1) Ensure your constructor is present and correct in your main view file:
2) Ensure the designer file was created correctly and has the correct information: