xCode 有没有办法在后退按钮和选项卡栏之间创建关系?

发布于 2024-12-07 07:48:19 字数 302 浏览 5 评论 0原文

大家好,我是 iPad 开发的新手。我在 xcode 中创建了一个 Tabbar 应用程序并创建了 5 个选项卡。我可以加载 5 个不同的视图。默认情况下,每个视图都由导航栏 cont 和选项卡栏组成。我在四个选项卡的导航栏中添加了一个后退按钮。当在详细信息页面(即选项卡 2)中时,我点击后退按钮,它会返回主页(第一个选项卡视图)。我转到其他选项卡,当我返回到第二个选项卡时,会显示主页。据我了解,当我单击后退按钮时,会创建一个新图层。如果是这样,那么当我重新访问选项卡时如何重新加载选项卡中的视图

任何人都可以让我知道可能是什么问题。

提前致谢, 克里斯

Hi I am a new bee to iPad development. I have created a Tabbar application in xcode and created 5 tabs. I am able to load 5 different views. Each view consists of a navigation bar cont and tabbar by default. I have added a back button to navigation bar to the four tabs. When in the detail pages i.e., Tab 2 I am tapping on the back button it returns to the Home page(First Tab View). and I go to other tabs and when I return to the 2nd tab home page is displayed. To my understanding when I am clicking on the back button a new layer is been created. if this so then how can I reload the view in the tabs when I revisit the tab

Can anybody let me know what could be the problem.

Thanks in advance,
Kris

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

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

发布评论

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

评论(1

独守阴晴ぅ圆缺 2024-12-14 07:48:19

从您的描述中很难理解您的确切问题,但从字里行间的阅读来看,您似乎将选项卡栏/视图控制器结构设置为错误的。我过去创建了一个类似的应用程序,其中根视图控制器中有一个选项卡栏,然后有 3 个导航视图控制器,每个控制器分配给选项卡栏的一个选项卡(但选项卡栏只有一个实例 - 看起来正在阅读您的消息)就像每个导航视图控制器都有一个?)

再考虑一下,如果您要为每个导航视图控制器创建一个新的选项卡栏,那么当您点击另一个选项卡时,您将创建另一个视图控制器,不久之后您就会拥有大量的视图控制器和标签栏 积极的。您的应用程序中应该只有一个标签栏。

如果您在切换选项卡时正确设置了它,那么您应该返回到之前在每个选项卡中拥有的推送视图控制器的任何级别。当选项卡以某种方式切换时,您是否有机会重新创建视图控制器?

Difficult to understand your exact problem from your description, but reading between the lines it sounds like you've set the tab bar / view controller structure up wrong to me. I have created a similar app in the past where I have a tabbar in the root view controller and then 3 navigation view controllers each assigned to a tab of the tab bar (but there's only one instance of the tab bar - reading your message it seems like you have one for each navigation view controller?)

Thinking about this more, if you are creating a new tab bar with each navigation view controller, then when you tap on another tab you are creating yet another view controller and before long you would have a massive number of view controllers and tab bars active. You should only have one tab bar in your app.

If you have it set up correctly when you switch tabs you should return to whatever level of pushed view controllers you previously had within each tab. Are you by any chance having to recreate the view controllers when the tab switch somehow?

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