UIViewControllers - TabBarApplication - iPhone SDK

发布于 2024-08-31 03:22:01 字数 342 浏览 2 评论 0原文

我对 iPhone SDK 非常陌生。我需要知道在选项卡栏应用程序中是否需要创建 UIViewController 类。例如,当我创建一个新的选项卡栏应用程序时,已经有一个默认的 FirstViewController 类(.h、.m)。现在,如果我在第二个选项卡上有代码,我是否需要创建 SecondViewController 类?如果没有,我将如何在第二个选项卡上创建一个按钮,并让该按钮执行某些操作。我不太确定如何做到这一点,因为 FirstViewController 使用按钮和代码,但如果我制作 SecondViewController,并且链接所有内容,我的应用程序就会崩溃。

如果有人可以提供帮助,我们将不胜感激。

凯文

I am very new to the iPhone SDK. I need to know if in a tab bar application I need to make UIViewController classes. For example, when I make a new tab bar application there is a default FirstViewController class (.h, .m) already there. Now if I have code on the second tab, would I need to create a SecondViewController class? If not, how would I make a button on the 2nd tab, and make that button do something. I'm not really sure how to do it, because the FirstViewController works with the buttons and code, but if I make a SecondViewController, and I link everything my app crashes.

If anyone could help it would be greatly appreciated.

Kevin

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

九八野马 2024-09-07 03:22:01

是的,每个选项卡都需要它自己的视图控制器和它自己的视图笔尖。如果您在 IB 的检查器中查看选项卡本身,您将看到您可以设置选项卡的数量,如果您选择每个选项卡,您可以告诉它哪个类处理该选项卡。确保将每个 nib 文件的文件所有者设置为正确的视图控制器类。您不需要在各个选项卡的控制器之间建立任何连接。如果您对某些事情有疑问,请检查 FirstViewController 文件(.h、.m 和 .xib)的所有连接。如果您仍然有问题,请发布尽可能多的详细信息,因为某些地方一定有问题。

Yes, each tab needs it's own view controller and it's own view nib. If you look in the inspector in IB for the tab itself you will see that you can set the number of tabs and if you select each tab you can tell it which class handles that tab. Make sure that you set the File's Owner for each nib file to the correct view controller class. You don't need to make any connections between the various tab's controllers. If you're in doubt about something check all the connections for the FirstViewController files(.h, .m, and .xib). If you still have issues post as many details as you can as something must be screwy somewhere.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文