带有视图的 TabBar 应用程序,该视图上有一个 UIButton,用于转到 TabBar 之外的另一个视图
我是 iPhone 开发新手,多个视图(xib 或 nib)真的让我感到困惑。这就是我想要实现的......
使用 TabBarControllerAppDelegate
有 5 个不同的 TabBar 项目,并通过 TabBarController 创建了 5 个不同的视图
第一个视图有一个 UIButton,它是一个 Next 按钮,需要转到另一个名为 View2.XIB 的视图。
我设置了一个新的 UIViewController,它引用 View2 和 switchPage 的 IBAction 等,但在单击按钮时无法让它执行任何操作。
我的选项卡栏的所有按钮都可以工作,但无法导航到选项卡栏之外的任何内容
。在这方面的任何帮助将不胜感激。谁有例子
I'm new to iPhone development, and multiple views (xib or nib) are really confusing me. This is what i'm trying to achieve...
using TabBarControllerAppDelegate
Have 5 different TabBar Items and have created 5 different Views thru the TabBarController
The First View has a UIButton that is a Next button that needs to go to another view called View2.XIB.
I setup a new UIViewController which references the View2 and an IBAction for the switchPage, etc but not able to get it to do anything when clicking on the button.
All of My TabBar buttons work but not able to Navigate to anything outside of the Tabbar
Any help in this regard will be highly appreciated. Anyone have any examples
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
{
[self.tabbarcontroller.tabBar setSelectedItem:[self.tabbarcontroller.tabBar.items objectAtIndex:1]];
这里 1 表示你的第二个标签栏
}
{
[self.tabbarcontroller.tabBar setSelectedItem:[self.tabbarcontroller.tabBar.items objectAtIndex:1]];
here 1 means ur 2nd tabbar
}
如果没有代码,很难找到问题,但我会假设您的 switchPage 按钮的操作代码不正确。您应该使用类似于以下的代码:
如果您确信您的方法有效,那么您将需要验证该操作是否正确连接。最简单的方法是在该方法上放置一个断点并在“调试”中运行该应用程序。当您单击该按钮时,调试器应该在您的方法上中断,如果没有,您将需要在 Interface Builder 中检查您的连接。
It is difficult to find the problem without the code, but I will assume your action code for the switchPage button is incorrect. You should use code similar to the following:
If you are confident your method works, then you will want to verify that the action is hooked up correctly. The easiest way to do this is to place a breakpoint on the method and run the app in Debug. When you click the button, the debugger should break on your method, if it doesn't, you will need to check your connections in Interface Builder.